From Clomosy Docs
(Created page with " function VarIsNull(const V: Variant): Boolean; VarIsNull returns true if the given variant contains the value Null. If the variant contains any other value, the function result is false.<br> Do not confuse a Null variant with an unassigned variant. A Null variant is still assigned, but has the value Null. Unlike unassigned variants, Null variants can be used in expressions and can be converted to other types of variants.<br> '''Example:'''<br> '''var''' valueInt :...") |
No edit summary |
||
| Line 5: | Line 5: | ||
'''Example:'''<br> | '''Example:'''<br> | ||
:'''Base Syntax''' | |||
'''var''' | '''var''' | ||
valueInt : Integer; | valueInt : Integer; | ||
| Line 33: | Line 34: | ||
ShowMessage('False');<br> | ShowMessage('False');<br> | ||
'''end;''' | '''end;''' | ||
:'''TRObject Syntax''' | |||
var | |||
valueInt : Integer; | |||
valueFlt : Float; | |||
valueStr : String; | |||
valueBool : Boolean; | |||
{ | |||
valueInt = nil; | |||
if (VarIsNull(valueInt)) | |||
ShowMessage('True'); | |||
else | |||
ShowMessage('False'); | |||
if (VarIsNull(valueFlt)) | |||
ShowMessage('True'); | |||
else | |||
ShowMessage('False'); | |||
if (VarIsNull(valueStr)) | |||
ShowMessage('True'); | |||
else | |||
ShowMessage('False'); | |||
valueBool = true; | |||
if (VarIsNull(valueBool)) | |||
ShowMessage('True'); | |||
else | |||
ShowMessage('False'); | |||
} | |||
'''Output:'''<br> | '''Output:'''<br> | ||
Revision as of 13:21, 12 February 2024
function VarIsNull(const V: Variant): Boolean;
VarIsNull returns true if the given variant contains the value Null. If the variant contains any other value, the function result is false.
Do not confuse a Null variant with an unassigned variant. A Null variant is still assigned, but has the value Null. Unlike unassigned variants, Null variants can be used in expressions and can be converted to other types of variants.
Example:
- Base Syntax
var valueInt : Integer; valueFlt : Float; valueStr : String; valueBool : Boolean;
begin
valueInt := nil; if VarIsNull(valueInt) then ShowMessage('True'); else ShowMessage('False'); if VarIsNull(valueFlt) then ShowMessage('True'); else ShowMessage('False'); if VarIsNull(valueStr) then ShowMessage('True'); else ShowMessage('False'); valueBool := true; if VarIsNull(valueBool) then ShowMessage('True'); else ShowMessage('False');
end;
- TRObject Syntax
var
valueInt : Integer;
valueFlt : Float;
valueStr : String;
valueBool : Boolean;
{
valueInt = nil;
if (VarIsNull(valueInt))
ShowMessage('True');
else
ShowMessage('False');
if (VarIsNull(valueFlt))
ShowMessage('True');
else
ShowMessage('False');
if (VarIsNull(valueStr))
ShowMessage('True');
else
ShowMessage('False');
valueBool = true;
if (VarIsNull(valueBool))
ShowMessage('True');
else
ShowMessage('False');
}
Output:
False True True False