How do I do "Or" in Episode?

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.)

1 Like

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”

1 Like

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.

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.

}

Does Episode only allow one condition per if-statement?

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) {

}
1 Like

Closing due to one month of inactivity :slight_smile: