# Multiple If Statements

I will use the following as an example:

If the player eats AND showers before opening the front door, when he opens the front door he will be prompted a certain question asking about whether the player wants to be teleported somewhere or not.

If the player ONLY eats or ONLY takes a shower before opening the front door, when he opens the front door he will be prompted a certain question asking about whether the player wants to be teleported to a second place or not.

If the player does NOT eat or take a shower before opening the front door, when he opens the front door he will be prompted a certain question asking about whether the player wants to be teleported to a third different place or not.

What would the code look like for the multiple if statements?

1 Like

well, I hope thereâ€™s no debate about when one must us ifâ€¦ elseif or caseâ€¦ select, but generally speaking, thereâ€™s two boolean variable, a perfect match for an ifâ€¦ elseif.

WI 11.5 â€śconditions and questionâ€ť should explain how to implement your â€śasking a certain questionâ€ť, after this, is a simple matter of checking the pair of boolean variables set after eating and taking shower.

IIRC, there was also a debate here about handling Take in the very specific case of â€śtaking a showerâ€ť. an hot-water debate, IIRCâ€¦

Best regards from Italy,
dott. Piergiorgio.

1 Like

Dunno effect of your showering or eating actions, but If youâ€™re just asking specifically for ifâ€¦else syntax in this case

``````"test" by Ade

Yourself can be clean or dirty.

Yourself can be hungry or fullup.

When play begins:
now the player is clean;
now the player is fullup.

The kitchen is a room.

The kitchen door is in the Kitchen.

Before opening the kitchen door:
if the player is clean AND the player is fullup:
say "Question about teleport to first place.";
else if the player is clean OR the player is fullup:
say "Question about teleport to second place.";
else if the player is dirty AND the player is hungry:
say "Question about teleport to third place.".
``````

(you donâ€™t need 3rd ifâ€¦but just for syntaxâ€¦!!)

2 Likes