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
Comparison operators can not only be used with numbers. What happens if you compare strings with the comparison operators
>? What rules are applied here?
Try to compare two strings with
==. What does this achieve?
Check what the result of
"1" == 1is. Do you understand it? If not, let the coach explain it to you!