diff options
author | Li Jin <dragon-fly@qq.com> | 2020-01-25 17:48:03 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2020-01-25 17:48:03 +0800 |
commit | ed317e62eb1cf98fde4461fc90c6cb1045ebc7e8 (patch) | |
tree | 427e365939da39f31dbfa755675fb60bb141583d /spec/inputs/loops.moon | |
parent | 4827d200604a086e2ad94edb4257c3abc7a3c4fc (diff) | |
download | yuescript-ed317e62eb1cf98fde4461fc90c6cb1045ebc7e8.tar.gz yuescript-ed317e62eb1cf98fde4461fc90c6cb1045ebc7e8.tar.bz2 yuescript-ed317e62eb1cf98fde4461fc90c6cb1045ebc7e8.zip |
fix Moonscript issue 375.
Diffstat (limited to 'spec/inputs/loops.moon')
-rw-r--r-- | spec/inputs/loops.moon | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/spec/inputs/loops.moon b/spec/inputs/loops.moon index 130570e..35427f6 100644 --- a/spec/inputs/loops.moon +++ b/spec/inputs/loops.moon | |||
@@ -1,133 +1,133 @@ | |||
1 | 1 | ||
2 | for x=1,10 | 2 | for x=1,10 |
3 | print "yeah" | 3 | print "yeah" |
4 | 4 | ||
5 | for x=1,#something | 5 | for x=1,#something |
6 | print "yeah" | 6 | print "yeah" |
7 | 7 | ||
8 | for y=100,60,-3 | 8 | for y=100,60,-3 |
9 | print "count down", y | 9 | print "count down", y |
10 | 10 | ||
11 | for a=1,10 do print "okay" | 11 | for a=1,10 do print "okay" |
12 | 12 | ||
13 | for a=1,10 | 13 | for a=1,10 |
14 | for b = 2,43 | 14 | for b = 2,43 |
15 | print a,b | 15 | print a,b |
16 | 16 | ||
17 | for i in iter | 17 | for i in iter |
18 | for j in yeah | 18 | for j in yeah |
19 | x = 343 + i + j | 19 | x = 343 + i + j |
20 | print i, j | 20 | print i, j |
21 | 21 | ||
22 | for x in *something | 22 | for x in *something |
23 | print x | 23 | print x |
24 | 24 | ||
25 | for k,v in pairs hello do print k,v | 25 | for k,v in pairs hello do print k,v |
26 | 26 | ||
27 | for x in y, z | 27 | for x in y, z |
28 | print x | 28 | print x |
29 | 29 | ||
30 | for x in y, z, k | 30 | for x in y, z, k |
31 | print x | 31 | print x |
32 | 32 | ||
33 | 33 | ||
34 | x = -> | 34 | x = -> |
35 | for x in y | 35 | for x in y |
36 | _ = y | 36 | _ = y |
37 | 37 | ||
38 | hello = {1,2,3,4,5} | 38 | hello = {1,2,3,4,5} |
39 | 39 | ||
40 | x = for y in *hello | 40 | x = for y in *hello |
41 | if y % 2 == 0 | 41 | if y % 2 == 0 |
42 | y | 42 | y |
43 | 43 | ||
44 | x = -> | 44 | x = -> |
45 | for x in *hello | 45 | for x in *hello |
46 | _ = y | 46 | _ = y |
47 | 47 | ||
48 | t = for i=10,20 do i * 2 | 48 | t = for i=10,20 do i * 2 |
49 | 49 | ||
50 | hmm = 0 | 50 | hmm = 0 |
51 | y = for j = 3,30, 8 | 51 | y = for j = 3,30, 8 |
52 | hmm += 1 | 52 | hmm += 1 |
53 | j * hmm | 53 | j * hmm |
54 | 54 | ||
55 | _ = -> | 55 | _ = -> |
56 | for k=10,40 | 56 | for k=10,40 |
57 | _ = "okay" | 57 | _ = "okay" |
58 | 58 | ||
59 | _ = -> | 59 | _ = -> |
60 | return for k=10,40 | 60 | return for k=10,40 |
61 | "okay" | 61 | "okay" |
62 | 62 | ||
63 | while true do print "name" | 63 | while true do print "name" |
64 | 64 | ||
65 | while 5 + 5 | 65 | while 5 + 5 |
66 | print "okay world" | 66 | print "okay world" |
67 | working man | 67 | working man |
68 | 68 | ||
69 | while also do | 69 | while also do |
70 | i work too | 70 | i work too |
71 | _ = "okay" | 71 | _ = "okay" |
72 | 72 | ||
73 | i = 0 | 73 | i = 0 |
74 | x = while i < 10 | 74 | x = while i < 10 |
75 | i += 1 | 75 | i += 1 |
76 | 76 | ||
77 | -- values that can'e be coerced | 77 | -- values that can'e be coerced |
78 | 78 | ||
79 | x = for thing in *3 | 79 | x = for thing in *3 |
80 | y = "hello" | 80 | y = "hello" |
81 | 81 | ||
82 | x = for x=1,2 | 82 | x = for x=1,2 |
83 | y = "hello" | 83 | y = "hello" |
84 | 84 | ||
85 | 85 | ||
86 | -- continue | 86 | -- continue |
87 | 87 | ||
88 | while true | 88 | while true |
89 | continue if false | 89 | continue if false |
90 | print "yes" | 90 | print "yes" |
91 | break if true | 91 | break if true |
92 | print "no" | 92 | print "no" |
93 | 93 | ||
94 | 94 | ||
95 | for x=1,10 | 95 | for x=1,10 |
96 | continue if x > 3 and x < 7 | 96 | continue if x > 3 and x < 7 |
97 | print x | 97 | print x |
98 | 98 | ||
99 | 99 | ||
100 | list = for x=1,10 | 100 | list = for x=1,10 |
101 | continue if x > 3 and x < 7 | 101 | continue if x > 3 and x < 7 |
102 | x | 102 | x |
103 | 103 | ||
104 | 104 | ||
105 | for a in *{1,2,3,4,5,6} | 105 | for a in *{1,2,3,4,5,6} |
106 | continue if a == 1 | 106 | continue if a == 1 |
107 | continue if a == 3 | 107 | continue if a == 3 |
108 | print a | 108 | print a |
109 | 109 | ||
110 | 110 | ||
111 | 111 | ||
112 | for x=1,10 | 112 | for x=1,10 |
113 | continue if x % 2 == 0 | 113 | continue if x % 2 == 0 |
114 | for y = 2,12 | 114 | for y = 2,12 |
115 | continue if y % 3 == 0 | 115 | continue if y % 3 == 0 |
116 | 116 | ||
117 | 117 | ||
118 | while true | 118 | while true |
119 | continue if false | 119 | continue if false |
120 | break | 120 | break |
121 | 121 | ||
122 | while true | 122 | while true |
123 | continue if false | 123 | continue if false |
124 | return 22 | 124 | return 22 |
125 | 125 | ||
126 | -- | 126 | -- |
127 | 127 | ||
128 | do | 128 | do |
129 | xxx = {1,2,3,4} | 129 | xxx = {1,2,3,4} |
130 | for thing in *xxx | 130 | for thing in *xxx |
131 | print thing | 131 | print thing |
132 | 132 | ||
133 | 133 | ||