Skip to main content

Conditional

case

  • case(condition_1, value_1, [condition_2, value_2, …​], default_value)
    • evaluate a list of conditions and returns the first value whose condition is evaluated to true. If all conditions are false, the default value is returned
let i = 10
case(i>10, "bigger than ten", i>=0, "positive", "negative") // return "positive"
let i = -10
case(i>10, "bigger than ten", i>=0, "positive", "negative") // return "negative"