How do you do a range using switch statement in ActionScript
For example:
score = txtScore.text
switch(score)
{
case 90 to 100: // how do you set the range?
txtScore.text = “A”;
break;
}
Thanks
How do you do a range using switch statement in ActionScript
For example:
score = txtScore.text
switch(score)
{
case 90 to 100: // how do you set the range?
txtScore.text = “A”;
break;
}
Thanks
you dont. All case comparisons are done through a strict equality (i.e. === ). You might just have to use if/else.
It can be done. You have to be a little creative though. Here’s some code for something like that.
on(release)
{
intNew = (parseInt(txtScore.text) / 10)
switch(parseInt(intNew))
{
case 10: txtGrade.text = "A";
break;
case 9: txtGrade.text = "A";
break;
case 8: txtGrade.text = "B";
break;
case 7: txtGrade.text = "C";
break;
case 6: txtGrade.text = "D";
break;
default: txtGrade.text = "F";
}
}
later
:: Copyright KIRUPA 2024 //--