Is there a way to use relational operators (<,<=,>,>=) in a switch statement?
int score = 95; switch(score) { case (score >= 90): // do s
Simply NO
int score = 95; switch(score) { case (score >= 90): // do stuff }
You are passing a int value to switch. So the case's must be in int values, where
int
switch
(score >= 90)
Turns boolean.
boolean
Your case is a good candidaate for if else
if else