Recall & Review
beginner
What does the
== operator do in Ruby?The
== operator checks if two values are equal. It returns true if they are the same, otherwise false.Click to reveal answer
intermediate
What is the difference between
== and === in Ruby?== checks if two objects are equal in value. === is used mainly in case statements to test if an object matches a condition or belongs to a class.Click to reveal answer
beginner
What does the
< operator do?The
< operator checks if the value on the left is less than the value on the right. It returns true if yes, otherwise false.Click to reveal answer
beginner
How does the
!= operator work?The
!= operator checks if two values are not equal. It returns true if they are different, otherwise false.Click to reveal answer
beginner
What will
5 >= 3 return in Ruby?It will return
true because 5 is greater than or equal to 3.Click to reveal answer
Which operator checks if two values are exactly equal in Ruby?
✗ Incorrect
The
== operator checks if two values are equal.What does the
!= operator do?✗ Incorrect
The
!= operator returns true if two values are not equal.Which operator is used in Ruby case statements to test matching?
✗ Incorrect
The
=== operator is used in case statements for matching.What will
4 < 2 return?✗ Incorrect
4 is not less than 2, so it returns false.
Which operator checks if left value is greater than or equal to right value?
✗ Incorrect
The
>= operator checks if left is greater than or equal to right.Explain how to compare two numbers to check if one is less than the other in Ruby.
Think about the symbol that means 'less than'.
You got /3 concepts.
Describe the difference between == and === operators in Ruby.
One is for simple equality, the other is for pattern matching.
You got /3 concepts.