From Clomosy Docs

No edit summary
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 8: Line 8:


<b>Example</b><br>
<b>Example</b><br>
<b>TRObject Syntax</b><br>
 
<pre>
<pre>
var
var
Line 41: Line 41:
   
   
  }
  }
</pre>
<b>Base Syntax</b><br>
<pre>
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;
</pre>
</pre>


Line 87: Line 53:
<h2> See Also </h2>
<h2> See Also </h2>
* [[System_Library#Boolean_Functions | Boolean Functions]]
* [[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

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:

See Also