Checks whether a value is empty.
is_empty(x:string|list|record) -> boolDescription
Section titled “Description”The is_empty function returns true if the input value is empty and false
otherwise.
x: string|list|record
Section titled “x: string|list|record”The value to check for emptiness.
The function works on three types:
- Strings: Returns
truefor empty strings ("") - Lists: Returns
truefor empty lists ([]) - Records: Returns
truefor empty records ({})
For null values, the function returns null. For unsupported types, the
function emits a warning and returns null.
Examples
Section titled “Examples”Check if a string is empty
Section titled “Check if a string is empty”from { empty: "".is_empty(), not_empty: "hello".is_empty(),}{ empty: true, not_empty: false,}Check if a list is empty
Section titled “Check if a list is empty”from { empty: [].is_empty(), not_empty: [1, 2, 3].is_empty(),}{ empty: true, not_empty: false,}Check if a record is empty
Section titled “Check if a record is empty”from { empty: {}.is_empty(), not_empty: {a: 1, b: 2}.is_empty(),}{ empty: true, not_empty: false,}Null handling
Section titled “Null handling”from { result: null.is_empty(),}{ result: null,}