Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
SAIL (programming language)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Basic structure and statements=== Like many ALGOL systems, and the later [[Pascal (programming language)|Pascal]], the basic structure of SAIL is based on the ''block'', which is denoted by the code between the keywords {{code|BEGIN}} and {{code|END}}. Within a block there is further structure, with the ''declarations'' of local variables at the top, if any, and the code, or ''statements'', following. In contrast to most dialects, SAIL allowed one to place a string after the {{code|BEGIN}}, like {{code|BEGIN "program"}}, and then end the block with {{code|END "program"}}. The compiler would use these, if entered, to check for proper bracketing.{{sfn|Smith|1976|p=13}} SAIL did not include the equivalent of a {{code|PROGRAM}} block as in Pascal, nor a {{code|main}} as in C, execution started with the first line of code in the outermost block.{{sfn|Smith|1976|p=48}} Standard statements included {{code|IF...THEN...ELSE}},{{sfn|Smith|1976|p=11}} {{code|FOR...STEP...UNTIL...DO}},{{sfn|Smith|1976|p=15}} {{code|WHILE...DO}} for top-tested loops, {{code|WHILE...UNTIL}} for bottom-tested, and {{code|GOTO}} which used a label.{{sfn|Smith|1976|p=17}} The {{code|CASE}} was similar to {{code|switch}} in C, but normally used a somewhat different syntax, like {{code|CASE i OF ("Zero","One","Two");}}, which returns the appropriate string based on the value of i.{{sfn|Smith|1976|p=11}} If one wanted to test explicit values in the CASE, the values had to be in square brackets: <syntaxhighlight lang=Pascal> CASE I OF BEGIN [0] 10; [4] 25; [6][7] 50 END; </syntaxhighlight> This code will ignore values like 1 to 3, and only return a value for the listed values. Note that the last item cannot have a semicolon following.{{sfn|Smith|1976|p=19}} {{code|DONE}} exited from a block, typically used in loops, and {{code|CONTINUE}} returned to the top of the block. An infinite loop was typically implemented with {{code|WHILE TRUE DO...}}.{{sfn|Smith|1976|p=18}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)