Syntax question: check...if...instead...

Sorry, two questions so quickly together! I am so demanding…

Anyway, struggling with syntax on this one, and can’t find any examples, but, with the following:

Check some_action: if the <condition>, say "Some text!" instead; if the <condition], say "Some other text!." instead; if <condition> begin; say "Yet more text"; now the variable of the player is 1; end if instead.

I’ve tried many many various combinations of that last ‘instead’. The first two work fine, and avoid the Carry out and Reporting parts…that last bit compiles, but still kicks into Carry Out…

What’s the syntax for including multiple statements within an if…instead construct?

Thanks!

McT

Sorry! Got it…bit of trial and error, this one on my part
For the record:

Check some_action: if the <condition>, say "Some text!" instead; if the <condition], say "Some other text!." instead; if <condition> begin; say "Yet more text"; now the variable of the player is 1 instead; end if.

n.b. I think my lengthy attempts were down to the fact that my first guess “end if instead.” actually compiled :slight_smile:

You can also use the phrase “stop the action” for that.

Check jumping:
    if the location is the Grand Canyon:
        say "That is a stupid idea.";
        decrease the score by 5;
        stop the action.

Yes…i was going to give in, and use that, but then I got determined to find out how, where and in what form that last instead got shoehorned in :slight_smile:

Thanks, D

McT

The “instead” modifier can’t be used on a block statement like “if” or “while”. (The compiler seems to accept it but thinks that you’re starting a new rule, which is not what you want.)

That really seems like an instance where the compiler should throw an error.