Xylem STORM 3 Basic Programming manual Uživatelský manuál Strana 23

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 48
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 22
21
Commands and Functions
Jumps to the specified label or line number within the program. GOTO statements never return
back to the point origin and thus have no RETURN statement. Subroutines, defined with the SUB
command, cannot be exited with the GOTO statement.
h = 3
w = 4
d = 5
GOTO 100 REM sets volume to 60
GOSUB ComputeArea REM is never run as above GOTO jumped below
END
LABEL ComputeArea
area = h * w
RETURN
100
volume = h * w * d
GOTO
Branches to the specified LABEL or line number within the program. Once a RETURN statement is
reached, execution is passed back to the statement immediately following GOSUB.
Subroutines, defined with the SUB command, provide a much more flexible method of executing
and running portions of code and should be used instead of GOSUB.
h = 3
w = 4
d = 5
GOSUB 100 REM sets volume to 60
GOSUB ComputeArea REM sets area to 12
END
LABEL ComputeArea
area = h * w
RETURN
100
volume = h * w * d
RETURN
GOSUB
Zobrazit stránku 22
1 2 ... 18 19 20 21 22 23 24 25 26 27 28 ... 47 48

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

Žádné komentáře