Hi guys i currently have a assignment which i just finished but their is one detail i dont love about it. Is there a way to shorten if else loops
Currently i have wrote
if (x >=300) {
set y = 1;
}
else if(x >=200) {
set y = 2;
}
else if (x >=150) {
set y = 3;
}
else if (x>=100) {
set y = 4;
}
else if (x >=50) {
set y = 5;
}
else if (x >=25) {
set y = 6;
}
Probably me just being pedantic, thanks in advance
Aucun commentaire:
Enregistrer un commentaire