mirror of
https://github.com/janet-lang/janet
synced 2025-01-11 08:00:27 +00:00
Clarify closure in loop test.
This commit is contained in:
parent
abe7d592aa
commit
6b8b21ce77
@ -203,9 +203,7 @@
|
||||
(assert (not= 0 1 1) "not= 2")
|
||||
|
||||
# Closure in while loop
|
||||
(def closures @[])
|
||||
(loop [i :range [0 5]]
|
||||
(array.push closures (fn [] i)))
|
||||
(def closures (for [i :range [0 5]] (fn [] i)))
|
||||
(assert (= 0 ((get closures 0))) "closure in loop 0")
|
||||
(assert (= 1 ((get closures 1))) "closure in loop 1")
|
||||
(assert (= 2 ((get closures 2))) "closure in loop 2")
|
||||
|
Loading…
Reference in New Issue
Block a user