if(score % 10 == 0) // Goes into 10 with no remainder
{
// Code to do on multiples here
}
DarkParadox wrote:You can use the modulus operator, "%", with an if statement.
"%" is like division with "/", but returns the remainder of the division. E.g. "3 % 10" would return "1" since "3" goes into "10" three times with one left over. You can check for multiples by using this and seeing if there's any remainder, and if there isn't, it was cleanly divisible.
- Code: Select all
if(score % 10 == 0) // Goes into 10 with no remainder
{
// Code to do on multiples here
}
if(condition);
{
// stuff
}
if(condition)
{
// stuff
}
if(score % 10 == 0)
{
// Code to do if score is a multiple of ten
}
if ((int)score.textNumber % 10 == 0)
{
//here comes the create actor code
}
Users browsing this forum: No registered users and 1 guest