Comparison Operators Exercise

In case you get stuck anywhere, don't be afraid to ask the coaches! They are here to help and will gladly explain everything to you!

Take notes during the exercises. Even if you never look at them again, they will help you memorise things!

For these exercises, we're only going to use IRB.

Remember: To run IRB, open a command line window (Powershell or Terminal). Then enter the command irb and press Enter.

To exit a running IRB, enter the command exit.

  1. Comparison operators can not only be used with numbers. What happens if you compare strings with the comparison operators < and >? What rules are applied here?

  2. Try to compare two strings with ==. What does this achieve?

  3. Check what the result of ​"1" == 1​ is. Do you understand it? If not, let the coach explain it to you!