Search⌘ K
AI Features

Challenge: Using Multiple Operators

Explore how to apply multiple Scala operators together to evaluate whether an integer value lies between two bounds. This lesson teaches how to combine relational and logical operators in Scala to create clear and effective conditional expressions, helping you understand practical operator usage in programming.

Problem Statement

You are given a variable check which stores an integer value. You have to create a variable compareCheck which checks if the value stored in check is less than 75 and greater than or equal to 8. The result should be true if it is between 8 and 75 and false if it isn’t.

Input

The input is the variable check.

check has already been declared for you.

Output

The output will be the value assigned to compareCheck.

Sample Input

3

Sample Output

false

Test Yourself

Write your code in the given area. Try the exercise by yourself first, but if you get stuck, the solution has been provided. Good luck!

Scala
// Rewrite compareCheck
val compareCheck = "temp"

Let’s go over the solution review in the next lesson.