Difference between revisions of "Goto"
From Lazarus wiki
Jump to navigationJump to search (Translated German text; clarified that "previously declared label" need not mean that the label itself lies before the goto statement.) |
|||
Line 1: | Line 1: | ||
{{goto}} | {{goto}} | ||
<br> | <br> | ||
− | '''Goto''' is an unconditional jump to previously declared [[label]]. | + | '''Goto''' is an unconditional jump to a previously declared [[label]] (either before or after the goto command). |
<br> | <br> | ||
+ | Example for the declaration of a label and use of goto: | ||
<br> | <br> | ||
− | + | <syntaxhighlight> | |
+ | var | ||
+ | fWaterIsBoiling: Boolean; | ||
+ | |||
+ | label | ||
+ | SwitchOffKettle; | ||
+ | |||
+ | begin | ||
+ | ... | ||
+ | if fWaterIsBoiling = True then Goto SwitchOffKettle; | ||
+ | ... | ||
+ | SwitchOffKettle: | ||
+ | ... | ||
+ | end; | ||
+ | </syntaxhighlight> | ||
[[category:Pascal]] | [[category:Pascal]] |
Revision as of 12:51, 27 October 2012
│
Deutsch (de) │
English (en) │
français (fr) │
русский (ru) │
Goto is an unconditional jump to a previously declared label (either before or after the goto command).
Example for the declaration of a label and use of goto:
var
fWaterIsBoiling: Boolean;
label
SwitchOffKettle;
begin
...
if fWaterIsBoiling = True then Goto SwitchOffKettle;
...
SwitchOffKettle:
...
end;