# How do I make "else" statement ?

Just started using Construct 2? Post your questions here

### » Wed Apr 15, 2015 5:13 pm

Hi ,
Lets assume we have 3 players, playing which each other (like soccer world cup group matches)), so every player plays once with any other.

So with 3 players games should look like
1 player vs 2 player
1 player vs 3 player
2 player vs 3 player

3 games altogether.

So I created 3 objects and compared their variables to decide the winner (lets say lowest wins):

So with variables 30/20/10 it is:

"Box 2 wins !"
"Box 3 wins !"
"Box 3 wins !"

But the same with variables 3/2/1 it is:
"Box 2 wins !"
"Box 3 wins !"
"Box 2 wins !"

Where is the mistake ? In "else" statement - is it misplaced ?

dropbox.com/s/gvhv46wjue8jawq/numbers%20compare.capx?dl=0

Actually, this sequence is called triangular numbers (3 , 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91 so on)
B
10
S
3
Posts: 25
Reputation: 709

### » Wed Apr 15, 2015 5:32 pm

In the "Compare parameter" condition you put the parameter index as the first value so it should be "Function: Parameter 1 <= ..." and not "Function: Parameter Self.Param(1) <= ...".
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,860

this way works!

thanks ramones
B
10
S
3
Posts: 25
Reputation: 709