lama_byterun/tutorial/Expressions.lama

17 lines
577 B
Text
Raw Permalink Normal View History

printf ("if, case, for, while etc. are all expressions.\n");
2020-02-19 15:28:29 +03:00
printf ("Case-expression: %s\n", case A (1, 2, 3) of A (x, y, z) -> z esac.string);
2020-03-08 00:57:25 +03:00
printf ("If-expression: %s\n", (if true then 2 else 3 fi +
if false then 6 else 7 fi).string);
printf ("Scope-expression: %s\n", (var i, s = 0;
2020-02-19 15:28:29 +03:00
for i := 0, i < 10, i := i + 1 do
s := s + i
od;
s
).string
2020-02-19 15:28:29 +03:00
)
2020-02-19 15:28:29 +03:00