Remote-processing CAMBASIC Uživatelský manuál Strana 79

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 208
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 78
Commands - 46
EXIT and EXIT CLEAR
Statement
SYNTAX: EXIT [line/label]
EXIT CLEAR
PURPOSE: To allow legal branching out of a loop structure.
REMARK S: Within FOR/ NEX T, GOSU B/RE TUR N and D O/U NTIL structures, it is sometimes necessar y to exit
the loop befor e the loop cond itions are m et.
EXIT C LEAR resets all stacks. It can be used in emergency stop (etc.) situations where the nesting
of loop structures cannot be known.
EXIT is always used with a line/label unless two or more levels are to be exited. When m ultiple
EXITs are used, the last one must have a line/label.
EXIT does not work in a DO/ENDDO structure.
EXAMPLE: 10 GOSUB 50
50 EXIT:GOTO 10
60 RETURN
Without the E XIT sta tement, the system w ould eventually crash, as the RE TUR N statem ent would
never be reached.
10 GOSUB 20
20 GOSUB 30
30 EXIT : EXIT 50
40 RETURN
50 GOTO 10
In this case there is a nested GOSUB structure. EXIT must be executed one time for each level of
nesting. F ailure to include two EXITs w ould have caused a stack imbalance on each pass.
Eventually, you would get a “Nesting” error message.
ERROR: < Can’t compile> if line/label does not exist
< Syntax> Trying to exit a non-recognized loop or structure
Zobrazit stránku 78
1 2 ... 74 75 76 77 78 79 80 81 82 83 84 ... 207 208

Komentáře k této Příručce

Žádné komentáře