In newLISP
, true
represents Boolean true
:
> (if true (println "yes") (println "no"))
yes
"yes"
while nil
represents Boolean false
:
> (if nil (println "yes") (println "no"))
no
"no"
Like lua, 0
is evaluated true
:
> (if 0 (println "yes") (println "no"))
yes
"yes"
empty list is also treated as false
:
> (if '() (println "yes") (println "no"))
no
"no"
Check the following result:
> (if false (println "yes") (println "no"))
no
"no"
The reason is false
is not defined here and its value is nil
:
> false
nil
You can assign true
to false
and do some crazy thing:
> (let (false true) (if false (println "yes") (println "no")))
yes
"yes"