aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs/goto.yue
blob: 61584caa7cb417c78db0e3632e3df94b469f418a (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
do
	a = 0
	::start::
	a += 1
	goto done if a == 5
	goto start
	::done::

do
	for z = 1, 10 do for y = 1, 10 do for x = 1, 10
		if x^2 + y^2 == z^2
			print 'found a Pythagorean triple:', x, y, z
			goto ok
	::ok::

do
	for z = 1, 10
		for y = 1, 10 do for x = 1, 10
				if x^2 + y^2 == z^2
					print 'found a Pythagorean triple:', x, y, z
					print 'now trying next z...'
					goto zcontinue
		::zcontinue::

do
	::redo::
	for x = 1, 10 do for y = 1, 10
		if not f x, y then goto continue
		if not g x, y then goto skip
		if not h x, y then goto redo
		::continue::
	::skip::

do
	for x in *t
		if x % 2 == 0
			print 'list has even number'
			goto has
	print 'list lacks even number'
	::has::