aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/inputs/goto.moon41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/inputs/goto.moon b/spec/inputs/goto.moon
new file mode 100644
index 0000000..3410ca3
--- /dev/null
+++ b/spec/inputs/goto.moon
@@ -0,0 +1,41 @@
1do
2 a = 0
3 ::start::
4 a += 1
5 goto done if a == 5
6 goto start
7 ::done::
8
9do
10 for z = 1, 10 for y = 1, 10 for x = 1, 10
11 if x^2 + y^2 == z^2
12 print 'found a Pythagorean triple:', x, y, z
13 goto done
14 ::done::
15
16do
17 for z = 1, 10
18 for y = 1, 10 for x = 1, 10
19 if x^2 + y^2 == z^2
20 print 'found a Pythagorean triple:', x, y, z
21 print 'now trying next z...'
22 goto zcontinue
23 ::zcontinue::
24
25do
26 ::redo::
27 for x = 1, 10 for y = 1, 10
28 if not f x, y then goto continue
29 if not g x, y then goto skip
30 if not h x, y then goto redo
31 ::continue::
32 ::skip::
33
34do
35 for x in *t
36 if x % 2 == 0
37 print 'list has even number'
38 goto has
39 print 'list lacks even number'
40 ::has::
41