🦋 Coding Tutorial: If/Elif/Else

Hi everyone, for my very first coding forums tutorial, I will be teaching you how to use the “If/Elif/Else” command!

This is a complicated one and I suggest that before you learn how to do this command, you should probably learn the choice command first but if you have learned that already, then let’s get started!

So first we are going to start with making a choice command, mine will be in this little details thing below so that it doesn’t take so much space.

My choice command (take a look to understand better!)
    ALMA (talk_greet_neutral)
    
Oh hi, Stella! How are you?

choice (RESPONSE)
“Be rude!” {
&ALMA is idle_armscrossed_angry_loop
STELLA (talk_doubtful)

I was kind of having alone time, Alma.

    STELLA (talk_accuse_angry)
    
Can you like leave?!

} “Be nice!” {
&ALMA is idle_happy_loop
STELLA (talk_greet_neutral)

Oh hi! Nice seeing you here.

} “Ignore her” {
&STELLA is idle_armscrossed_awkward_loop
ALMA (talk_doubtful)

That was rude! You could have at least said something!

}
@transition fade out in 2.0

So if you looked at that “choice command” you would see that there is a different part of it them normal, there is a (RESPONSE) next to the “choice” command word.
That (RESPONSE) thing is very important
It is like a label that you would use to organize and manage the script better.

Next is the If/Elif/Else command but first here is a bit of information you may need!

Information

There are three different formats of this command.
There is:
If/Else- This is for a two-option choice where there are only two outcomes.
If- This is for only one outcome.
If/Elif/Else- This is for a three-option choice where are going to be three outcomes!

For the If/Elif you will have to put beside it the (RESPONSE or your label is “Be rude!” or whatever your option was) but for the Else, it will be the other/last option in the choice.
This will make more sense when you continue to read.

So here is the If/Elif/Else command:

If/Elif/Else command

if (RESPONSE is “Be rude!”) {
STELLA (idle_sad_timid_loop)

(I shouldn't have been so harsh on her, now she won't come to finish the project and I will get an F!)

} elif(RESPONSE is “Be nice!”) {
@ALMA walks to spot 1.22 100 50 AND STELLA is admire_happy AND ALMA faces right
STELLA (talk_excited_happy)

You came!

}
else {
@ALMA walks to spot 1.22 100 50 AND ALMA faces right AND STELLA is idle_armscrossed_awkward_loop then ALMA is idle_armscrossed_angry_loop
ALMA (talk_armscrossed_angry_loop)

We need to talk about you ignoring me today!

}
@transition fade out in 2.0

You can even use this command with a gap between the choice and the If/Elif/Else command and put some dialogue or something in that gap, these can be made to make your story or stories have choices that matter and make your stories even more entertaining for readers to read!

So there you have it! Go try it for your self and it will make a ton more sense, for more questions please reply below and I will get back to you as soon as I can!

Feel free to follow me for more help!

@brii_writes_epi on Instagram for any questions you may have!

5 Likes

I love this! Good job, bump! :blob_hearts:

1 Like

Tysm!!

1 Like