ISEMPTY

The function ISEMPTY returns TRUE if the given object, string, or list is empty.

This function takes an object, string, phone, email or list as input. It outputs a boolean indicating whether the given object, string, or list is empty: TRUE means that it is empty, FALSE means that it is not. It can also accept NULL as input, in which case it will return TRUE.

Declaration

ISEMPTY(var) -> bool

 

Parameters

var (type: object | string | array | NULL)
Any object, string, or list. It will also accept a lack of value, or NULL, as valid input.

Return Values

bool (type: boolean)
A boolean indicating if var is empty. It will output TRUE if it is empty and FALSE otherwise.

Examples

In practice, input fed into the ISEMPTY function is very rarely hardcoded; there is no real need to use software to check if an object, string, or array is empty after just typing it. However, for the sake of clarity, the following examples will use hardcoded input in order to demonstrate what ISEMPTY will output given certain types of input.

The first example checks to see if an empty list is empty; that is, if the empty list does not contain any items. It does not:

ISEMPTY([]) -> TRUE

The following example checks to see if a blank string is empty; that is, if the blank string does not contain any characters. It does not:

ISEMPTY("") -> TRUE

The following example checks to see if a list containing a single blank string is empty. This list does not count as empty – it contains an item, even that item is only a single blank string:

ISEMPTY([""]) -> FALSE

The following example checks to see if an object containing no name-value pairs is empty. The complete lack of name-value pairs makes this object empty by definition:

ISEMPTY({}) -> TRUE

The following example checks to see if an object containing a single name-value pair – in which the name and the value are both blank strings – is empty. While the name and value are both blank strings, their existence means that the object contains name-value pair, and thus the object doesn't count as empty:

ISEMPTY({"": ""}) -> FALSE

The last example checks if NULL – the lack of any value – is empty. For the purposes of the ISEMPTY function, lack of any value counts as empty:

ISEMPTY(NULL) -> TRUE

 

Discussion

The ISEMPTY function can be considered the opposite of the ISNOTEMPTY function: they check for the same thing, but ISNOTEMPTY returns FALSE when ISEMPTY would return TRUE and visa versa.