Operators

Operators #


Operators are used in many scenarios. Note that there are two types of operators

  • Logic Operators
  • Mathematical Operators

Logic Operators #

  • Used for comparisions between two or more objects

Mathematical Operators #

  • Used for mathematical operations

Examples of Logic Operators #

  • == (Checking if two things are equal)
  • != (Checking if two things are not equal)
  • > (Checking if the first object is greater than the second object)
  • < (Checking if the first object is less than the second object)
  • >= (Checking if the first object is greater than or equal to the first object)
  • <= (Checking if the first object is less than or equal to the first object)
  • || (If this is true or that is true, then the whole thing is true) (Only in If Statement)
  • && (This and that have to be true for the whole thing to be true) (Only in If Statement)
  • and (If this is true or that is true, then the whole thing is true)
  • or (This and that have to be true for the whole thing to be true)

Examples of Mathematical Operators #

  • + (Adding two items)
  • - (Subtracting two items)
  • \* (Multiplying two items)
  • / (Dividing two items)
  • % (Modulus(Basically remainder))