From Clomosy Docs
No edit summary |
ClomosyAdmin (talk | contribs) No edit summary |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert"> | |||
function VarIsNull(const V: Variant): Boolean; | |||
</div> | |||
VarIsNull returns true if the given variant contains the value Null. If the variant contains any other value, the function result is false.<br> | 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> | 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> | ||
<b>Example</b><br> | |||
<pre> | |||
var | |||
valueInt : Integer; | valueInt : Integer; | ||
valueFlt : Float; | valueFlt : Float; | ||
valueStr : String; | valueStr : String; | ||
valueBool : Boolean; | valueBool : Boolean; | ||
valueInt | { | ||
if VarIsNull(valueInt) | |||
valueInt = nil; | |||
if (VarIsNull(valueInt)) | |||
ShowMessage('True'); | ShowMessage('True'); | ||
else | else | ||
ShowMessage('False'); | ShowMessage('False'); | ||
if VarIsNull(valueFlt) | if (VarIsNull(valueFlt)) | ||
ShowMessage('True'); | ShowMessage('True'); | ||
else | else | ||
ShowMessage('False'); | ShowMessage('False'); | ||
if VarIsNull(valueStr) | if (VarIsNull(valueStr)) | ||
ShowMessage('True'); | ShowMessage('True'); | ||
else | else | ||
ShowMessage('False'); | ShowMessage('False'); | ||
valueBool | valueBool = true; | ||
if VarIsNull(valueBool) | if (VarIsNull(valueBool)) | ||
ShowMessage('True'); | ShowMessage('True'); | ||
else | else | ||
ShowMessage('False'); | ShowMessage('False'); | ||
} | |||
</pre> | |||
<b>Output:</b><br> | |||
<div class="alert alert-success" role="alert" data-bs-theme="light"> | |||
False<br> | |||
True<br> | |||
True<br> | |||
False<br> | |||
</div> | |||
<h2> See Also </h2> | |||
* [[System_Library#Boolean_Functions | Boolean Functions]] | |||
{{#seo:|title=Using VarIsNull in Clomosy - Clomosy Docs}} | |||
{{#seo:|description=Discover how the VarIsNull function checks for Null values in variants in Clomosy, with practical examples for efficient use.}} | |||
Latest revision as of 13:39, 24 December 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
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