Conditional structures/ALGOL 68: Difference between revisions

m
Minor improvements
m (moved Conditional Structures/Ada to Conditional Structures/ALGOL 68: Code look more like ALGOL 68 code... :-))
m (Minor improvements)
 
(One intermediate revision by one other user not shown)
Line 126:
PROC do_something = INT: random;
PROC do_something_else = INT: random;
input := (TRUE | do_something | do_something_else); # only calls do_something_elsedo_something() #
)</lang>
The "( ~ | ~ | ~ )" is directly interchangeable with the "IF ~ THEN ~ ELSE ~ FI" syntax. Hence the above could be written:
Line 136:
PROC do_something = INT: random;
PROC do_something_else = INT: random;
input := IF TRUE THEN do_something ELSE do_something_else FI; # only calls do_something_elsedo_something() #
)</lang>
A more complex example created by combining the above:
Line 143:
CASE 2 IN x,y OUT z ESAC := IF 1+2=2 THEN 333 ELSE 666 FI
)</lang>
In the result y becomes halffully-evil, with x and z remaining undefined.
3,021

edits