-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfor.lua
More file actions
43 lines (43 loc) · 1002 Bytes
/
for.lua
File metadata and controls
43 lines (43 loc) · 1002 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
local n = 0
for _, i in list({}, {_to_null(1, 2, 3)}) do
n = (n + 1)
assert(bool({}, (i == n)))
::loop_label_1::
end
local d = dict({}, {[_to_null(1)] = _to_null(1), [_to_null(2)] = _to_null(2), [_to_null(3)] = _to_null(3)})
for _, k, v in d.items(merge_kwargs({}, {})) do
assert(bool({}, (k == v)))
::loop_label_2::
end
n = 0
for _, i in range(merge_kwargs({}, {}), 10) do
assert(bool({}, (i == n)))
n = (n + 1)
::loop_label_3::
end
assert(bool({}, (n == 10)))
n = 1
for _, i in range(merge_kwargs({}, {}), 1, 5) do
assert(bool({}, (i == n)))
n = (n + 1)
::loop_label_4::
end
assert(bool({}, (n == 5)))
n = 1
for _, i in range(merge_kwargs({}, {}), 1, 10, 2) do
assert(bool({}, (i == n)))
n = (n + 2)
::loop_label_5::
end
assert(bool({}, (n == 11)))
n = 10
for _, i in range(merge_kwargs({}, {}), 10, 1, (-2)) do
assert(bool({}, (i == n)))
n = (n - 2)
::loop_label_6::
end
assert(bool({}, (n == 0)))
return {
n = n,
d = d,
}