-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExampleFile.wu
77 lines (55 loc) · 1.2 KB
/
ExampleFile.wu
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
77
-- Comment
---
Multi
line
Comment
---
"Strings with \Escapes"
r"Raw strings with no \escape"
if, elif, else, for, while, loop, return
--------------------------------------------
(Also a valid multiline comment)
Example program: Bad RPG
--------------------------------------------
Wand :: struct {
damage: float = 0.001
weigt: string = "rather heavy"
}
Class :: struct {
name: string
height: int
weapon: { damage: float, weight: string }
}
wizard := Class {
name : "gargamel"
height: 102
weapon: Wand {}
}
main :: () -> loop {
beginning := prompt("you are in a swamp, walk left or right? [y/N] ")
match beginning lowercase() {
| "y" -> print("ok fair")
| _ -> print("sure, fine")
}
height := prompt("how tall? [0-9+]")
wizard height = height to_int()
print("ok, now again ...\n")
}
--------------------------------------------
(Also a valid multiline comment)
Example program: Balls
--------------------------------------------
-- making a lot of balls
-- an anonymous structure
ball := {
x: float = 100
y: float = 100
}
-- infinite arrays
balls: [ball] = []
for i in 0 .. 100 {
balls[i] = ball {
math random(0, 100)
math random(0, 100)
}
}