Empty test

Learn how to check if a value is empty.

This test checks whether a value is empty.

An operand is considered empty if it is null, an empty string, or a collection with no elements. Anything else is considered not empty.

Syntax

This test has the following syntax:

/*<value>*/ is empty
Try in Playground

To negate the test, use the following syntax:

/*<value>*/ is not empty
Try in Playground

Parameters

These are the supported parameters:

value
any

The value to validate.

Examples

Here is an example of how to check if a string is empty:

"Hello, world!" is empty // false
Try in Playground

And this is how you can check if a collection is empty:

[] is empty // true
Try in Playground