ifs

Returns the value that corresponds to the first true condition.
Accepts
Returns
Syntax
ifs(condition, ifTrue, condition2, ifTrue2, ..., else) condition.ifs(ifTrue, condition2, ifTrue2, ..., else)

This can be used as an alternative to multiple nested if() statements.

ifs(
    1 + 1 == 1, "1 plus 1 equals 1.", 
    1 + 1 == 3, "1 plus 1 equals 3.", 
    "1 plus 1 equals 2."
)ifs(

    /* Check if 1 + 1 equals 1, and if it does display "1 plus 1 equals 1." */
    1 + 1 == 1, "1 plus 1 equals 1.",

    /* Otherwise check if 1 + 1 equals 2, and if it does display "1 plus 1 equals 3." */
    1 + 1 == 2, "1 plus 1 equals 3.",

    /* Otherwise display "1 plus 1 equals 2." */
    "1 plus 1 equals 2."
    
)
=
1 plus 1 equals 2. "1 plus 1 equals 2."