-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram.crow
More file actions
76 lines (59 loc) · 862 Bytes
/
Copy pathprogram.crow
File metadata and controls
76 lines (59 loc) · 862 Bytes
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
int bar :: 99
fn foo :: {
a: int;
b: string;
} > string !> 97 do
if a < 10 then
throw 97
end
ret b + ": " + (str a)
end
type t :: "abc" | "def" | "ghi"
m: int = 3
$n: int = 6
@baz
$n += 1
if m > n then
print "m > n"
goto @baz
else
print "m <= n"
end
mmm := {
a: int = 1;
b := 2;
$c: float = 3;
}
q := [m, mmm] do
if m > mmm then
ret mmm
ret mmm
ret mmm
elif m == mmm then
ret m
elif m == mmm then
ret m
else
ret mmm
end
end
s := foo! { 5; "hello"; } # maybe throws
s2r := foo { 5; "hello"; } # returns tagged union
if s2r.failed then
print s2c.err
end
s2 := s2r.value # has now same type as s
for@cb i in {1; 2; 3;} do
$j := i
while $j < 10 do
if $j < 5 then
break @cb
end
print i
$j += 1
end
end
test "some unit tests" do
assert 1 == 1
end
exit 1