How do I do "Or" in Episode?


#1

If I want to do something like

if ((x = “" ) || (x = "”) || (x = “___”))
{


}

How can I do this? I haven’t found anything on the forum about it, and I’m fairly new to Episode’s formatting. (I’m familiar with Javascript, but Episode is clearly different, so “||” didn’t work for me.)


#2

Episode’s “coding” is definitely nothing like java or html. If you read the guides in the portal, they have everything you need to know on how to direct your episodes. Here is a guide I created to help you learn how to do “or”


#3

I apologize if I missed something in the resource you provided, but how would I do a triple condition like… here’s a bad example:

if favourite colour is blue OR if favourite colour is red OR if favourite colour is green
{
YOU
We share a favourite colour!
}
else
{
YOU
I don’t like any of those.
}

Obviously, I could easily solve this with the if/elif/else; but if I have something more complicated and complex branching, I’d hope I wouldn’t have to copy and paste for each “else if”.

Thanks in advance.


#4

It depnds on how you “saved” the reader’s choice (through gains or choice name with choice option).

I’m using a gain example:

if (blue) {
YOU
We share a favourite colour!

} elif (red) {
YOU
We share a favourite colour!

} elif (green) {
YOU
We share a favourite colour!

} else {
YOU
I don’t like any of those.

}

#5

Does Episode only allow one condition per if-statement?


#6

If you’re using “or”, then yes. But you can combine conditions, like say you want an outcome to happpen for 2 or more gains it would look something like this:

if (gain1 and gain2) {

} elif (gain1 and gain3) {

}

#8

Closing due to one month of inactivity :slight_smile:


#9