if
Returns one value if an expression is true
, and another if it is false
if(logical_test, value_if_true, [value_if_false])
if(test1, value1, test2, value2, ... [default_value])
You can also string multiple expressions together for example:
if(test1, "value1", test2, "value2", "default value")
In an alternate form, multiple logical tests can be tried in sequence.
if(true, "pass", "fail")
returns"pass"
if(false, "pass", "fail")
returns"fail"
try
try(a, [b, ...])
Tries each value until a "truthy" one is found (true/non-empty/non-null).
try("", "first", "second")
returns"first"
try(null, false, true)
returnstrue
and
and(list1, list2, [...])
Tests whether a series of values are all true/non-empty. Expects several equal length lists of booleans.
you may test a series of lists of the same length: a list of booleans will be returned
all()
will flatten all lists first, then test for true/non-empty
Returns a list that has a true
arg if all the elements of the lists are true
at that index, and false
otherwise.
and(true, true, true)
returnstrue
and(false, true)
returnsfalse
and(false, false)
returnsfalse
and("hello", "world")
returnstrue
and("hello", "")
returnsfalse
and("", "")
returnsfalse
and(list(true, true), list(true, false))
returns[true, false]
and(list(true, true), list(true, true))
returns[true, true]
or
or(list1, list2, [...])
Tests whether any of a series of values are true/non-empty. Expects several equal length lists of booleans.
Returns a list that has a true arg if any of the elements of the lists are true at that index, and false otherwise.
you may test a series of lists of the same length; a list of booleans will be returned
any()
will flatten all lists first, then test for true/non-empty
none
none()
Tests whether all of a series of values/lists are false/empty and returns true if so.
Equivalent to not(any())
not
not(boolean_expression_or_list)
Returns the opposite of a boolean operation. Given true, returns false, and vice-versa.
If given a list, applies itself to each item in the list (broadcasts). Empty lists therefore map to empty lists.
Non-Boolean interpretation
The following non-boolean-interpretation behavior may be subject to change and should not be relied upon. It exists only to preserve legacy behavior that some applications still need.
It is preferable to explicitly compare values with the =
operator for all new formulas.
Given a non-boolean value, Neara attempts to map it as follows:
Value | Maps to |
|
Note: this can have surprising behavior with absolute values like temperatures and coordinates |
|
|
empty text: |
|
|
|
a list of non-boolean values | Will be interpreted according to whether it is empty or not |
Mathematical boolean tests
Operator | Usage |
| equal to |
| equal to |
| not equal to |
| not equal to |
| less than |
| less than or equal to |
| greater than |
| greater than or equal to |
| checks if a number is within specified lower and upper bounds |