[if]

if is a core slot, one of the keywords of the Hyperlambda language, in Hyperlambda, the language of Magic Cloud. Evaluates the child lambda only if the condition is true; chain with [else-if] and [else] for additional branches.

  • Scope: provides if

Arguments

Required arguments come first, then the optional ones in the order they are declared.

Argument Type Required Description
any node name lambda yes Condition node evaluated for truthiness.
[.lambda] lambda yes Executable lambda block.

Guide: How to use [if]

JSON declaration

This is the complete declaration of if, as the running system describes it. It is also published as slot.json.

JSON declaration
{
  "name": "if",
  "description": "Evaluates the child lambda only if the condition is true; chain with [else-if] and [else] for additional branches",
  "signature": {
    "children": {
      "*": {
        "type": "lambda",
        "kind": "boolean",
        "description": "Condition node evaluated for truthiness",
        "required": true,
        "mode": "ExecutableLambda",
        "cardinality": "ExactlyOne",
        "role": "Condition",
        "evaluation": "EvalSelf",
        "projection": "Value"
      },
      ".lambda": {
        "type": "lambda",
        "description": "Executable lambda block",
        "required": true,
        "mode": "ExecutableLambda",
        "cardinality": "ExactlyOne",
        "role": "LambdaBlock",
        "evaluation": "EvalBlock",
        "projection": "Self"
      }
    },
    "scope": {
      "provides": "if"
    }
  }
}

← hyper2lambda all core slots include →