Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Extend-your-language/ALGOL-68/extend-your-language.alg
Normal file
13
Task/Extend-your-language/ALGOL-68/extend-your-language.alg
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# operator to turn two boolean values into an integer - name inspired by the COBOL sample #
|
||||
PRIO ALSO = 1;
|
||||
OP ALSO = ( BOOL a, b )INT: IF a AND b THEN 1 ELIF a THEN 2 ELIF b THEN 3 ELSE 4 FI;
|
||||
|
||||
# using the above operator, we can use the standard CASE construct to provide the #
|
||||
# required construct, e.g.: #
|
||||
BOOL a := TRUE, b := FALSE;
|
||||
CASE a ALSO b
|
||||
IN print( ( "both: a and b are TRUE", newline ) )
|
||||
, print( ( "first: only a is TRUE", newline ) )
|
||||
, print( ( "second: only b is TRUE", newline ) )
|
||||
, print( ( "neither: a and b are FALSE", newline ) )
|
||||
ESAC
|
||||
Loading…
Add table
Add a link
Reference in a new issue