Booleans can have only two values : false or true.
They can be casted to integer types, false being 0 and
true being 1.
You can cast any type to a boolean : integers 0 and character NUL
being false and everything else being true. This is useful for
boolean operations : accept any tag as a condition and if it
evaluates to true after a cast then proceed. This is how
if_then_else and while and many KC3 operators are implemented.
ikc3> true && true
true
ikc3> true && false
false
ikc3> if "" do "ok" else "ko" end
"ok"
ikc3> if 1 do "ok" else "ko" end
"ok"
ikc3> if 0 do "ko" else "ok" end
"ok"
ikc3> (Bool) ""
true
ikc3> (Bool) 1
true
ikc3> (Bool) 0
false
ikc3> "ok" == "ok"
true
ikc3> "ok" == "ko"
false
Top : KC3 documentation
Previous : 1.03 Block
Next : 1.05 Callable