+ 3

Is there any simpler way to write this code?

https://code.sololearn.com/c5nzd1tAOBVN/?ref=app

28th Nov 2018, 12:23 PM
Evan11010
4 Respostas
+ 5
Instead of nested ifs you could use AND operator
28th Nov 2018, 12:27 PM
Jakub Stasiak
Jakub Stasiak - avatar
+ 1
You can use switch Statement too
30th Nov 2018, 2:33 PM
Nidhal Baccouri
0
Use && operators if(age>8 && age<13){...} else if(age>=13 && age<20){...} else if(age>=20 && age<60){...} else if(age>=60){...}
30th Nov 2018, 2:02 PM
Brian Tomas
Brian Tomas - avatar