If Else Op

This operation runs if and returns evaluated true expression or evaluated false expression.

Definition: ["ifElse", <check: expression(boolean)>, <trueResult: expression(any)>, <falseResult: expression(any)>]

Usage

Request:

["ifElse", ["value", true], ["value", "true value"], ["value", "false value"]]

Response:

"true value"

Typical Usage

This operation is used when one or the other expression needs to evaluated and returned based on some check.

Example:

Request:

["ifElse", 
  ["run", "userExists", 1], 
  ["value", "There is an user with ID 1"], 
  ["value", "No user found."] 
]

Response:

"There is an user with ID 1"