Skip to content

Conditions

KikoPT1234 edited this page Jun 5, 2020 · 4 revisions

Conditions are used to check if the value satisfies a condition (hence the name). If it does, they will return a value of true. Otherwise, they will return a value of false. For example:

const number = 2
number == 2 // true
number == 3 // false
  • == checks if a value is equal to another
  • != checks if a value is not equal to another
  • ! negates the condition
  • < less than
  • > greater than
  • <= less than or equal to
  • >= greater than or equal to

There are also the AND and OR operators:

number == 3 & number == 2 // false
number == 3 | number == 2 // true

Conditions are mostly used when paired with if statements.

<- Previous | Next ->

Clone this wiki locally