Automatic conversion to Boolean
Describes the automatic conversion of non-Booleans to Booleans.
When a function, method or statement which expects a Boolean value as one of its arguments is passed a non-Boolean value, this value is automatically converted to a Boolean value as follows:
The number
0yieldsfalse.The empty string
""yieldsfalse.The null value yields
false.The undefined value yields
false.Any other non-Boolean values yield
true.
For example:
if ("") writeln("True"); else writeln("False");
if (123) writeln("True"); else writeln("False");
This displays “False”, then “True”.