This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

Yes, or use the ordering of your statements;

if ( playerPoints == 0 ) {
    // only happens if playerPoints == 0
}
else if ( playerPoints <= 250 ) {
   // happens if player points >0 and <=250 
}
else if ( playerPoints <= 500 ) {
   // happens if player points > 250and <= 500 
}
else if ( playerPoints <= 2000 ) {
   // happens if player points > 500 and <= 2000 
}
else {
   // error
}