11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Caché</strong> <strong>ObjectScript</strong> CommandsQUIT and GOTOThe QUIT command within the block of code ends the WHILE loop and returns executionto the command following the closing curly brace, as shown in the following example:MainloopSET x=1WHILE x < 10{WRITE !,"looping "SET x=x+1WRITE " x=",xQUIT}WRITE " done"returns: looping x=2 doneA GOTO command within the block of code may direct execution to a tag outside the loop,terminating the loop. A GOTO command within the block of code may direct execution toa tag within the same block of code; this tag may be in a nested code block. A GOTO commandwithin the block of code may not direct execution to a tag within another code block.The following forms of GOTO are legal:mainloop ; Example of a GOTO to outside of the code blockWHILE 1=1 {WRITE !,"In an infinite WHILE loop"GOTO tagWRITE !,"This should not display"}WRITE !,"This should not display"tagWRITE !,"Went to tag and quit"QUITmainloop ; Example of a GOTO to within the code blockSET x=1WHILE x

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!