Anonymous user
Boolean values: Difference between revisions
just Pascal
No edit summary |
(just Pascal) |
||
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
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}}==
Line 216 ⟶ 185:
=={{header|Oz}}==
<tt>true</tt> and <tt>false</tt> are the only boolean values. No other values are automatically converted to bool.
=={{header|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:
▲var
▲ pInt : ^integer ;
▲ ValidP : boolean ;
▲</lang>
▲<lang pascal>
▲if pInt then ...
▲</lang>
▲or
▲if pInt^ then ...
▲</lang>
▲Will always be a syntax error. The following correct evaluations of variables are allowed:
▲<lang pascal>
▲if not(pInt = nil) then ValidP := true ;
▲</lang>
▲or
▲if ( ValidP ) and (pInt^ <> 0) then ...
▲</lang>
=={{header|Perl}}==
|