O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 returns False.

  • Although IsEmpty can take an expression as the value of varname, it always returns False 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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required