| Home | Previous Lesson: CHOOSE CASE...END CHOOSE Next Lesson: Arrays |
In PowerScript, any statement may be labeled by preceding it with an identifier name and a colon on it's own line.
The identifier can be any legal PowerScript identifier that is not reserved word. Label names are distinct from variable and function names, so you do not need to worry about name collisions if you give a label the same name as a variable or function. Here is an example of a labeled statement:
CommonExit:
DESTROY �
�
Return
By labeling a statement, you give it a name that you can use to refer to it elsewhere in your script. You can label any statement, and jump to it from anywhere in the script. The labels are commonly referred in the GOTO statement from deeper loops to come out of the outer most loop and/or to directly jump to a specific label. However, PowerBuilder programmers use GOTO statement very rarely.
FOR i = li_counter1 TO li_counter2
FOR j = li_counter3 TO li_counter4
FOR k = li_counter5 TO li_counter5
/* Some code */
GOTO Done
NEXT
NEXT
NEXT
/* Some Code */
Done:
/* Some Code */
| Home | Previous Lesson: CHOOSE CASE...END CHOOSE Next Lesson: Arrays |