Minilisp.pm/t/unless.t
MadMaurice c954f0216f when, unless: check for wrongful evaluation
when and unless must not evaluate their bodies if the condition does not require it.
2021-04-05 04:07:22 +02:00

9 lines
247 B
Raku

(expect "unless - true condition"
(null (unless t 'fail)))
(expect "unless - false condition"
(equal 'ok (unless nil 'ok)))
(let ((a 'ok))
(unless t (set a 'fail))
(expect "unless - does not evaluate on true" (equal a 'ok)))