+ 3
Is there any simpler way to write this code?
4 Réponses
+ 5
Instead of nested ifs you could use AND operator
+ 1
You can use switch Statement too
0
Use && operators
if(age>8 && age<13){...}
else if(age>=13 && age<20){...}
else if(age>=20 && age<60){...}
else if(age>=60){...}