WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Advantages of While over Goto


The advantages of "While @True" over GOTO...
  1. It tells you the instant you see it that this is an infinite loop. With GOTO you won't know that until you reach the end of the loop and see the goto statement. And if it's a very long loop, it might not be obvious even then. So "While @True" results in cleaner, more maintainable code.

  2. A while loop allows you to use BREAK and CONTINUE. With GOTO you'd have to use more GOTOs, and it you wouldn't know if those GOTOs were breaking, or continuing, or just flying off in a random direction, until you searched through the code to find their destinations. Again: While @True results in cleaner, more maintainable code.

Article ID:   W17885
Filename:   Advantages of While over Goto.txt
File Created: 2008:11:25:12:09:28
Last Updated: 2008:11:25:12:09:28