From Clomosy Docs

No edit summary
No edit summary
 
Line 38: Line 38:
<h2> See Also </h2>
<h2> See Also </h2>
* [[System_Library#Boolean_Functions | Boolean Functions]]
* [[System_Library#Boolean_Functions | Boolean Functions]]
{{#seo:|title=Assigned Usage- Clomosy Documentation}}
{{#seo:|description=Clomosy's Assigned function checks if a reference is null, returning True for non-zero references and False for zero, preventing runtime errors.}}
{{#seo:|description=Clomosy's Assigned function checks if a reference is null, returning True for non-zero references and False for zero, preventing runtime errors.}}

Latest revision as of 13:24, 24 December 2024

The assigned function checks if a reference is null. Returns True if non-zero, False if zero. Using a Nil reference will result in an exception.

Example

var
 myValue : Integer;
 myValue2 :Integer;
 valueStr : String;

{
 myValue = 10;
 if (Assigned(myValue))
 ShowMessage('myValue is not nil')
 else ShowMessage('myValue is nil');
  
 myValue2 = Nil;
 if (Assigned(myValue2))
 ShowMessage('myValue2 is still not nil')
 else ShowMessage('myValue2 is nil');
  
 if (Assigned(valueStr))
 ShowMessage('valueStr is still not nil')
 else ShowMessage('valueStr is nil');
}

Output:

See Also