Anonymous user
Boolean values: Difference between revisions
no edit summary
(Added Oz) |
No edit summary |
||
Line 76:
* 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|Delphi / Turbo Pascal / Standard Pascal}}==
In all flavors of pascal there is no such foolishness as numbers of empty strings or pointers ( initialized or otherwise ) being evaluated as boolean. There is the boolean type as defined by the RTL statements such as:
<lang>
var
pInt : ^integer ;
ValidP : boolean ;
</lang>
<lang>
if pInt then ...
</lang>
or
<lang>
if pInt^ then ...
</lang>
Will always be a syntax error. The following correct evaluations of variables are allowed:
<lang>
if not(pInt = nil) then ValidP := true ;
</lang>
or
<lang>
if ( ValidP ) and (pInt^ <> 0) then ...
</lang>
=={{header|E}}==
|