# Question about If / Else/if

Just started using Construct 2? Post your questions here

### » Mon Aug 11, 2014 8:39 am

Im starting to understand how events in C2 works, but sometimes i see an else statement put it in two different ways:

https://www.dropbox.com/s/5klb8h96dbh2vkq/Screenshot%202014-08-11%2004.45.35.png

and this:

https://www.dropbox.com/s/1v85b9mxd3oqz5g/Screenshot%202014-08-11%2004.49.28.png

My question is about, if this two ways of using the else, are the same, or different?

and if they are different, how they are different?? for me look the same

cheers and tx!
B
9
S
2
Posts: 52
Reputation: 1,360

### » Mon Aug 11, 2014 8:53 am

Same result, different structure.

The first makes the item = 1 as as subevent and the second as a condition.

So if event = 1 then it does xyz else it does abc.

But in both cases, it will do nothing as no action is placed after the check if item = 1

The second is probably the better way, especially if you are making a tree of if/else but it is matter of preference.

If x =1
if y=2
if z=3
else text = z
else text = y
else: text = x
Last edited by DUTOIT on Mon Aug 11, 2014 8:58 am, edited 3 times in total.
You think you can do these things, but you can't, Nemo!
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,743

### » Mon Aug 11, 2014 8:57 am

My best practice is to use nested events like your first picture. It helps me to debug faster and better.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

### » Mon Aug 11, 2014 9:51 am

The second form does give you more flexibility. I'm only doing 1 line of logging here, but you could do whatever you want.

elsetype2.png

This isn't possible in this form:

elsetype1.png
You do not have the required permissions to view the files attached to this post.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

### » Mon Aug 11, 2014 5:53 pm

Tx all of you, for the replys!!

Cheers!
B
9
S
2
Posts: 52
Reputation: 1,360