Which operator checks if one value is less than another?

Study for the End of Year 8 Computer Science Test. Prepare with flashcards and multiple choice questions, each with hints and explanations. Get ready for your exam!

Multiple Choice

Which operator checks if one value is less than another?

Explanation:
Relational operators compare two values. The less than operator checks whether the left value is strictly smaller than the right value. It yields true when that is the case and false otherwise. For example, 5 < 8 is true, while 9 < 3 is false. This is what you’d use in a conditional statement, like if a < b then do something, to decide which path to take. The other operators describe different relationships: greater than tests if the first value is larger, equal to tests if the values are exactly the same, and not equal to tests if they differ.

Relational operators compare two values. The less than operator checks whether the left value is strictly smaller than the right value. It yields true when that is the case and false otherwise. For example, 5 < 8 is true, while 9 < 3 is false. This is what you’d use in a conditional statement, like if a < b then do something, to decide which path to take. The other operators describe different relationships: greater than tests if the first value is larger, equal to tests if the values are exactly the same, and not equal to tests if they differ.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy