Statements

Like in all programing languages there are statements, so we added statements

IF statement

An "if statement" is a programming structure that executes a block of code only if a specific condition is true, and skips it otherwise or execute some other componenta.

Basic syntax

Example
click_commands:
  - "if"
  - "  [require(permission,permission.node)]"
  - "do"
  - "  [message] yes"
  - "else"
  - "  [message] else"
  - "end"
# or without the else part
click_commands:
  - "if"
  - "  [require(permission,permission.node)]"
  - "do"
  - "  [message] yes"
  - "end" 

How to use the statements

The if statement is a control structure in many programming languages that allows you to execute a block of code conditionally, based on the truth value of a specified expression. In this case, the expression being evaluated is .

Here's the if statement with an else clause:

click_commands:
  - "if"
  - "  [require(permission,permission.node)]"
  - "do"
  - "  components"
  - "else"
  - "  components"
  - "end"
  • if - keyword used to begin an if statement

  • - expression that is evaluated as true or false

  • do - keyword used to begin the block of code to be executed if the expression is true

  • the components that will be runned if the expression is true

  • else - keyword used to specify the block of code to be executed if the expression is false

  • the components that will be executed if the expression is false

  • end - keyword used to end the if statement

Here's the if statement without an else clause:

click_commands:
  - "if"
  - "  [require(permission,permission.node)]"
  - "do"
  - "  components"
  - "end"
  • if - keyword used to begin an if statement

  • - expression that is evaluated as true or false

  • do - keyword used to begin the block of code to be executed if the expression is true

  • the components that will be executed if the expression is true

  • end - keyword used to end the if statement

Last updated