Boolean values

Sidef defines the true and false boolean values, which are part of the Bool type.

var t = true
var f = false

In conditional expressions, anything that evaluates to zero or nothing is considered false, including empty arrays and empty hashes.

if (0 || "0" || false || nil || "" || [] || :()) {
    say "true"
} else {
    say "false"
}

Output:

false

Last updated