blob: 6af570d9ce976921f67aef943f963d6feba9ea66 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/* 'any' doesn't actually exist but at the moment I'm not checking types so as
* long as there's some type identifier here the compiler will not complain,
* will eventually have to fix */
fwd_println(any a);
guard(bool cond, () err, () ok)
{
if cond {
err();
} else {
ok();
}
}
try_print_one(int a)
{
guard(a < 1) => {
fwd_println("smaller than 1");
} => ;
guard(a > 1) => {
fwd_println("larger than 1");
} => ;
fwd_println(a);
}
main()
{
try_print_one(0);
try_print_one(1);
try_print_one(2);
}
|