For "repetitions" you have the modulo operation. What you actually want is the code to be executed at:
score = 5
score = 15
score = 25
....
So at a period size of "10", when you do the modulo operation with "10" as second argument you do get such a period.
0 % 10 = 0
1 % 10 = 1
2 % 10 = 2
3 % 10 = 3
4 % 10 = 4
5 % 10 = 5
6 % 10 = 6
7 % 10 = 7
8 % 10 = 8
9 % 10 = 9
10 % 10 = 0
11 % 10 = 1
12 % 10 = 2
...
From this is ought to be obvious.
if score >= 50 {
show_message('ObiWan Wins');
game_end();
} else if ( score % 10 = 5) {
show_message('Vader Wins');
game_end();
}
As a side node I changed the if score <= 50
to else if
- while making no difference in this case, when you choose between two option you don't want them both to be executed at the same time