LOG IN SIGN UP
Documentation

if()

Implements a ternary operator for strings; if the expression is true, it returns value-when-true; if the expression is false, it returns value-when-false. When the if(x, value-when-true, value-when-false); argument is true, the value-when-true is returned. Otherwise, the value-when-false is returned.

You can use if() as a construct to make simple conditional expressions more concise.

Format

STRING
if(BOOL expression, STRING value-when-true, STRING value-when-false)

Examples

1
set req.http.foo-status = if(req.http.foo, "present", "absent");