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
myStruct = {};
writeOutput( structIsEmpty( myStruct ) );
Result: true
Test to see if a struct contains something
myStructWithThings = {
"one" : "foo",
"two" : "bar"
};
writeOutput( structIsEmpty( myStructWithThings ) );
Result: false
Using Member Function
myStruct = {};
writeOutput( myStruct.IsEmpty() );
Result: true
Additional Examples
// 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>" );
Related
Last updated
Was this helpful?