Underscore and ampersand

From CometWiki

Jump to: navigation, search

Underscore and ampersand

The line continuation (_) and multiple statement on a line (&) characters can be combined to produce a connected and structured code block. For example, the following IF/THEN statement includes multiple actions to be taken if the condition is true:

     IF OPTION$="QUIT" THEN_
     CLOSE (1) &_
     PRINT (0) "STOPPING PROGRAM NOW." &_
     PRINT (0) "PRESS ENTER TO CONTINUE." &_
     INPUT (0) "" &_
     RUN "QMONITOR"

Note: This example could also be written with the IF/ENDIF structure. In that case, the line continuation and multiple statements characters would not be used. For more information, see the IF statement.

Personal tools