Challenge: Fix the Code

This lesson explains the usage of logical expressions with the help of a coding challenge.

“is between” operator #

We’ve seen above that the < and the > operators are used to determine whether a value is less than or greater than another value, but there is no operator that answers the question “is between?” to determine whether a value is between two other values.

Let’s assume that a programmer has written the following code to determine whether a value is between 10 and 20. Observe how the program throws a compilation error:

Get hands-on with 1200+ tech skills courses.