Incorrect quiz answer for Logical Operations quiz?

One of the quiz answers seems incorrect, afaict

What does [] && 2 < 3 return?

  • It causes an error.
  • []
  • true
  • false
EXPLANATION

This operation is an inversion of the previous. It also does not short-circuit, and the expression 2 < 3 (which evaluates to true ) is the last operand evaluated.

This questions asks what it returns, not what it evaluates to. So the correct answer, afaict, should be “2<3”. But that isn’t an option, and “true” is what you have to pick to get the question marked correct. As supporting evidence, the previous question is the same thing but with the order reversed and the correct answer being “[ ]”.

Hi Erica,

“Evaluates to” and “return value” always refer to the same thing. In this case, ruby evaluates 2 < 3 and returns true because “2 is less than 3” is a true statement and the operators ==, <, >, <=, and >= always return true or false.