contents   index   previous   next

goto and labels


You may jump to any location within a function block by using the goto statement. The syntax is:


goto LABEL;


where label is an identifier followed by a colon (:). The following code fragment continuously prompts for a number until a number less than 2 is entered.



Screen.write("Enter a number less than 2:")

var x = getche();     //get a value for x

if (a >= 2)

   goto beginning;



As a rule, goto statements should be used sparingly, since they make it difficult to track program flow.


Conditional operator