sGoto: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: sGoto
| Old | New | Line | |
|---|---|---|---|
| 1 | + | Back to [[local compiler directives]]. | |
| 2 | + | ||
| 3 | + | # \$GOTO | |
| 4 | + | ||
| 5 | + | The **\$GOTO** directive: | |
| 6 | + | ||
| 7 | + | - determines whether jump commands can be used; | |
| 8 | + | - knows the ON and OFF switches; | |
| 9 | + | - defaults to {\$GOTO OFF}. That is, no jump commands are allowed; | |
| 10 | + | - can be enabled if the directive is {\$GOTO ON}, the compiler supports the [[Goto|GOTO]] and [[Label|LABEL]] commands; | |
| 11 | + | - corresponds to the -Sg command line switch. | |
| 12 | + | ||
| 13 | + | Example: | |
| 14 | + | ||
| 15 | + | ``` pascal | |
| 16 | + | {$GOTO ON} | |
| 17 | + | ||
| 18 | + | label TheEnd; | |
| 19 | + | ||
| 20 | + | begin | |
| 21 | + | If ParamCount = 0 then | |
| 22 | + | GoTo TheEnd; | |
| 23 | + | Writeln('Parameters were passed on the command line'); | |
| 24 | + | TheEnd: | |
| 25 | + | end. | |
| 26 | + | ``` | |
| 27 | + | ||
| 28 | + | Note for inline assembler: If labels are used in the assembly code, the directive {\$GOTO ON} must be used. | |
| 29 | + | ||
| 30 | + | --- | |
| 31 | + | *From the Free Pascal wiki, page "sGoto", as it stood on 2020-02-16 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
