Anonymous user
Boolean values: Difference between revisions
→{{header|D}}: add implementation
(→TI-89 BASIC: new example) |
(→{{header|D}}: add implementation) |
||
Line 53:
For more information, follow the links from [http://www.lispworks.com/documentation/HyperSpec/Body/t_ban.htm CLHS: Type BOOLEAN].
=={{header|D}}==
In D, there are constants true and false to represent their respective values.
Implicit conversions are listed below:
* any integer type, where 0 converts to false, and any other value converts to true
* any floating point type, where again, 0 gives false and everything else gives true
* any enumeration type, again 0 gives false, anything else true
* any pointer type, where the null pointer gives false and any other pointer gives true
* any reference type, where the null reference gives false and any other reference gives true
* any user-defined type with an implicit conversion operator either to bool or to a built-in type which itself can be converted to bool
=={{header|E}}==
|