Ages between 18-24, if statement
java
Solution
there is no easy "is one of" operator in java, if you want that you need to do
if(age == 18 || age == 19 || age == 20 || age == 21 || age == 21 || age == 22 || age == 23 || age == 24)
but since you have a range where the value needs to be in, you can do
if(age >= 18 && age <= 24)
Problem
I'm a beginner and I'm doing all the Java exercises on programmingbydoing. I get errors in my code cause I don't know what "symbol" or structure I'm supposed to be using. `else if ( age == 18 || 19 || 20 || 21 || 22 || 23 || 24 ) { System.out.println ( "You can vote but not rent a car" + name); }`