Name
IsEmpty Function
Syntax
IsEmpty(varname
)
varname
Use: Required
Data Type: Any
A numeric or string expression.
Return Value
Boolean (True
or False
).
Description
Determines whether the variable has been initialized by having
an initial value (other than Empty
) assigned to it.
Rules at a Glance
If the variant passed to IsEmpty has not been initialized,
True
is returned; otherwise, IsEmpty returnsFalse
.Although IsEmpty can take an expression as the value of
varname
, it always returnsFalse
if more than one variable is used in the expression. IsEmpty is therefore most commonly used with single variables.
Programming Tips and Gotchas
When passed an object variable that has been set equal to
Nothing, the IsEmpty function returns False
. Hence, the function should not be
used to test whether a previously initialized object variable now
holds a valid object reference.
Get VBScript in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.