Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Enumerations/ALGOL-68/enumerations-1.alg
Normal file
13
Task/Enumerations/ALGOL-68/enumerations-1.alg
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
BEGIN # example 1 #
|
||||
MODE FRUIT = INT;
|
||||
FRUIT apple = 1, banana = 2, cherry = 4;
|
||||
FRUIT x := cherry;
|
||||
CASE x IN
|
||||
print(("It is an apple #",x, new line)),
|
||||
print(("It is a banana #",x, new line)),
|
||||
SKIP, # 3 not defined #
|
||||
print(("It is a cherry #",x, new line))
|
||||
OUT
|
||||
SKIP # other values #
|
||||
ESAC
|
||||
END;
|
||||
24
Task/Enumerations/ALGOL-68/enumerations-2.alg
Normal file
24
Task/Enumerations/ALGOL-68/enumerations-2.alg
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
BEGIN # example 2 #
|
||||
MODE ENUM = [0]CHAR; # something with minimal size #
|
||||
MODE APPLE = STRUCT(ENUM apple), BANANA = STRUCT(ENUM banana), CHERRY = STRUCT(ENUM cherry);
|
||||
MODE FRUIT = UNION(APPLE, BANANA, CHERRY);
|
||||
|
||||
OP REPR = (FRUIT f)STRING:
|
||||
CASE f IN
|
||||
(APPLE):"Apple",
|
||||
(BANANA):"Banana",
|
||||
(CHERRY):"Cherry"
|
||||
OUT
|
||||
"?" # uninitalised #
|
||||
ESAC;
|
||||
|
||||
FRUIT x := LOC CHERRY;
|
||||
|
||||
CASE x IN
|
||||
(APPLE):print(("It is an ",REPR x, new line)),
|
||||
(BANANA):print(("It is a ",REPR x, new line)),
|
||||
(CHERRY):print(("It is a ",REPR x, new line))
|
||||
OUT
|
||||
SKIP # uninitialised FRUIT #
|
||||
ESAC
|
||||
END
|
||||
Loading…
Add table
Add a link
Reference in a new issue