Literals & quoting

Booleans

Full

True and False, how any value becomes Boolean, and that Bool is a number.

Bool has two values, True and False. Any value can be viewed as a Boolean — its "truthiness" — and Bool is itself an Int enum, so it participates in arithmetic.

The two values #

say True;
say False;
say True.Int;
Output
True
False
1

Truthiness — so / ? #

so (and the prefix ?) coerces any value to Bool. Zero, the empty string, and empty collections are false; almost everything else is true.

say so 5;
say so 0;
say so "";
Output
True
False
False

Bool is a number #

True and False are the enum values 1 and 0, so they add up — handy for counting matches.

say True + True;
say (5 > 3);
Output
2
True

Notes #