procedure TForm1.W3Button6Click(Sender: TObject);
var
a: Variant = undefined;
b: Variant = null;
c: Variant = true;
d: Variant = '';
e: Variant = Unassigned;
f: Variant;
begin
// returns true if the given variant is valid (does not contain the value Null nor undefined/Unassigned.
WriteLn( VarIsValidRef(a) ); // false
WriteLn( VarIsValidRef(b) ); // false
WriteLn( VarIsValidRef(c) ); // true
WriteLn( VarIsValidRef(d) ); // true
WriteLn( VarIsValidRef(e) ); // false
WriteLn( VarIsValidRef(f) ); // false
// returns true if the given variant contains the value Unassigned/undefined
WriteLn( VarIsEmpty(a) ); // true
WriteLn( VarIsEmpty(b) ); // false
WriteLn( VarIsEmpty(c) ); // false
WriteLn( VarIsEmpty(d) ); // false
WriteLn( VarIsEmpty(e) ); // true
WriteLn( VarIsEmpty(f) ); // true
// returns true if the given variant contains the value Null.
WriteLn( VarIsNull(a) ); // false
WriteLn( VarIsNull(b) ); // true
WriteLn( VarIsNull(c) ); // false
WriteLn( VarIsNull(d) ); // false
WriteLn( VarIsNull(e) ); // false
WriteLn( VarIsNull(f) ); // false
end;
|