LOG IN SIGN UP
Documentation

if()

Implements a ternary operator for strings; if the expression is true, it returns TRUE; if the expression is false, it returns FALSE. For example, you have an if(x, true-expression, false-expression); if this argument is true, the true-expression is returned. Otherwise, the false-expression is returned.

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

Format

STRING
if(BOOL expression, STRING valueiftrue, STRING valueiffalse)

Examples

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