Xylem STORM 3 Basic Programming manual Manuel d'utilisateur Page 23

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 48
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 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
Vue de la page 22
1 2 ... 18 19 20 21 22 23 24 25 26 27 28 ... 47 48

Commentaires sur ces manuels

Pas de commentaire