if()
if(predicate, then_expr, else_expr) returns then_expr if predicate is true, and else_expr otherwise.
Returns
If
predicateis exactlytrue, we returnthen_expr.Otherwise, we return
else_expr.
Examples
# evaluates to "red" if the color is red, "green" otherwise
if(color_is_red, "red", "green")Last updated
Was this helpful?