mirror of
https://github.com/janet-lang/janet
synced 2024-12-26 00:10:27 +00:00
(and ... <truthy-value> true) will return true
as per docs.
This commit is contained in:
parent
02c7cd0194
commit
4cc4a9d38b
@ -280,7 +280,7 @@
|
|||||||
(while (> i 0)
|
(while (> i 0)
|
||||||
(-- i)
|
(-- i)
|
||||||
(def v (in forms i))
|
(def v (in forms i))
|
||||||
(set ret (if (= ret true)
|
(set ret (if (= i (- len 1))
|
||||||
v
|
v
|
||||||
(if (idempotent? v)
|
(if (idempotent? v)
|
||||||
['if v ret v]
|
['if v ret v]
|
||||||
|
@ -345,6 +345,8 @@
|
|||||||
(assert (= (and 0 1 nil) nil) "and 0 1 nil")
|
(assert (= (and 0 1 nil) nil) "and 0 1 nil")
|
||||||
(assert (= (and 1) 1) "and 1")
|
(assert (= (and 1) 1) "and 1")
|
||||||
(assert (= (and) true) "and with no arguments")
|
(assert (= (and) true) "and with no arguments")
|
||||||
|
(assert (= (and 1 true) true) "and with trailing true")
|
||||||
|
(assert (= (and 1 true 2) 2) "and with internal true")
|
||||||
|
|
||||||
(assert (= (or true true) true) "or true true")
|
(assert (= (or true true) true) "or true true")
|
||||||
(assert (= (or true false) true) "or true false")
|
(assert (= (or true false) true) "or true false")
|
||||||
|
Loading…
Reference in New Issue
Block a user