ifstatement allows you to control whether a collection of content is shown or not. When you write an
ifstatement, you provide an expression, which is checked; if that expression evaluates to a "true" value, then all of the content in between the
<<endif>>statements are run.
$gold_amount, to 5. It will then show the line "I'd like to buy a pie!", and before it continues, it will check to see if
$gold_amountis less than 10. If that's the case (which it will be!), the line "Well, you can't afford one!" will run.
elsestatements to handle different situations in an
elseifstatement has an expression that gets checked if the
ifstatement, or any previous
elseifstatements, don't run.
elsestatement doesn't have an expression, and runs
$gold_amount. The checks are done from top to bottom, which means that in order for an
elseto run, all of the checks above it have to have failed.
$reputation, you might want to make certain options only available if the value of
$reputationis high enough.
ifstatement to the end of the option. They look like this:
ifstatement. If the expression is
false, then the option will be marked as unavailable.