27.12.2016, 14:00
Is there any downsides of using this
Than this
I read somewhere that switch isn't for large number of cases not sure if switching 5000 cases would be ok or im better off with if else.
Code:
if(Score >= 0) else if(Score > 49 && Score < 100) else if(Score > 99 && Score < 250) else if(Score > 249 && Score < 500) else if(Score > 499 && Score < 1000) else if(Score > 999 && Score < 2500) else if(Score > 2499 && Score < 5000) else if(Score > 4999)
Code:
switch(Score) { case 0..49: case 50..99: case 100..249: case 250..499: case 500..999: case 1000..1499: // and so on }