blob: 35a6b632cde7021181d8b6ed2e1a45718e392553 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
register nat n
register nat x
register nat y
function unit main _ = {
(* works - x and y are set to 42 *)
n := 1;
y :=
(switch n {
case 0 -> { x := 21; x }
case 1 -> { x := 42; x }
case x -> { x := 99; x }
});
(* doesn't work - main returns 1 instead of 42 *)
n := 1;
switch n {
case 0 -> { 21 }
case 1 -> { 42 }
case x -> { 99 }
}
}
|