From Clomosy Docs
No edit summary |
ClomosyAdmin (talk | contribs) 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:|description=Clomosy's Assigned function checks if a reference is null, returning True for non-zero references and False for zero, preventing runtime errors.}} | |||
Revision as of 15:07, 23 December 2024
function Assigned (var P ):Boolean;
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:
myValue is not nil
myValue2 is nil
valueStr is nil