Skip to content

Instantly share code, notes, and snippets.

@blam23
Last active December 20, 2015 00:28
Show Gist options
  • Select an option

  • Save blam23/6041543 to your computer and use it in GitHub Desktop.

Select an option

Save blam23/6041543 to your computer and use it in GitHub Desktop.
Conditional Operators Segment

I took this out of the main tutorial to keep the size down, and keep this accessible.

This is part of the Toribash Scripting Tutorial.

  • > - Greater Than - If the variable on the left is greater than the variable on the right, it's true. If they are equal or the left is smaller it's false.

      10 > 20 = false
      20 > 20 = false
      30 > 20 = true
    
  • < - Less Than - If the variable on the left is less than the variable on the right, it's true. If they are equal or the left is greater it's false.

      10 < 20 = true
      20 < 20 = false
      30 < 20 = false
    
  • >= Greater Than or Equal To - The same as greater than but will also be true if the variables are equal.

      10 >= 20 = false
      20 >= 20 = true
      30 >= 20 = true
    
  • <= Less Than or Equal To

      10 <= 20 = true
      20 <= 20 = true
      30 <= 20 = false
    
  • ~= Not equal to - If the variables are different, this will be true, otherwise if they are the same it will be false.

      10 ~= 20 = true
      20 ~= 20 = false
      30 ~= 20 = true
    
  • and If the variable on the left AND the variable on the right are true, it will be true.

      10 < 20 and 20 < 30 = true
      30 < 20 and 20 < 30 = false
      30 < 20 and 30 < 30 = false
    
  • or If either the left or the right is true, it's true

      10 < 20 or 20 < 30 = true
      30 < 20 or 20 < 30 = true
      30 < 20 or 30 < 30 = false
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment