IsEmpty

Determine whether a given value is empty.

We check for emptiness of anything that can be casted to: Array, Struct, Query, or String.

Method Signature

IsEmpty(value=[any])

Arguments

Argument
Type
Required
Description
Default

value

any

true

The value/object to check for emptiness.

Examples

Test to see if a struct is empty

Run Example

myStruct = {};
writeOutput( structIsEmpty( myStruct ) );

Result: true

Test to see if a struct contains something

Run Example

myStructWithThings = { 
	"one" : "foo",
	"two" : "bar"
};
writeOutput( structIsEmpty( myStructWithThings ) );

Result: false

Using Member Function

Run Example

myStruct = {};
writeOutput( myStruct.IsEmpty() );

Result: true

Additional Examples

Run Example

// Non empty struct
animals = {
	COW : "moo",
	PIG : "oink"
};
// Empty struct
farm = {};
// StructIsEmpty(animals)
echo( "<p>Animals struct is empty: " & StructIsEmpty( animals ) & "</p>" );
// StructIsEmpty(farm)
echo( "<p>Farm struct is empty: " & StructIsEmpty( farm ) & "</p>" );

Last updated

Was this helpful?