The difference between "if" and "elif"

Hey guys!
I was just wondering… is there any difference between
if (condition) {}
if (condition) {}

and
if (condition) {}
elif (condition) {}
?
Episode guidelines recommend the second one, but I can’t see why not to use just two ifs. Can anybody tell me? Thank you!

2 Likes

this might help HOW TO: Remember Past Choices (if/elif/else)

1 Like

I think it depends on what your choice is, for example, if you want to remember a past choice and you used gain command it will be the if elif else choice since the person could just choose one option.
I used the if/if choice when I’ve a condition for nested choices.
With this I mean that if you let the reader choose in 2 choices 2 different ending, you have 4 possible endings. Putting the if if code you establish that if the reader chose option A and then B he has an ending while who chose option B and then A has another one.
I hope this makes sense :sweat_smile::joy:

1 Like

How do u make like and if elif clothing template

I can’t really imagine that situation :smiley: gain choice don’t work with if/if conditions?

if (condition1) {}
if (condition2) {}

I’ve personally never used this myself. It has a lot of issues if you use it often as the reader could skip over pieces of content in the script because it hasn’t been coded correctly.

if (condition) {}
elif (condition) {}
else {}

This I use a lot. It’s basically saying "If you don’t have condition one, then the reader might have condition two. If they don’t have either, then they go to else.

Yes, but I usually used if if and it works the same - but I didn’t use gains in my stories. Only choices that you need to choose. Then if/if and if/elif works the same :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.