Search
ctrl/
Ask AI
Light
Dark
System

Sets

Subtopics

There are cases when you may want to return some special value instead of an empty set. This is possible to do with the coalescing operator - ??. This operator returns the first operand if it's not empty and the second operand otherwise:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

This makes the coalescing operator useful when you have or might have an empty set:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

Similarly there are versions of the comparison operators ?= and ?!= that allow comparing to an empty set. These operators always return a boolean value with the rule that an empty set is equal to another empty set and nothing else (other values work the same as for = and !=). Try it out and compare to plain = and !=:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input
Input
Run
Output Objects
Press the 'Run' button to evaluate the input