Difference between choice vs fake_choice

In CS each option of a *choice must end with a *goto otherwise it will throw an error. This also happens when *elseif or *else is used. You will get this error if you do not use the *goto:

It is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the indented block.
It is illegal to fall in to an *else statement; you must *goto or *finish before the end of the indented block.

Implicit control flow is an optional setting you can use to disable this error message, allowing you the option to use *goto at their ends or not. I like it because it removes the need for redundant *gotos and *labels after the *elseif and *else.

So imagine you want to do something like this:

   *if (money >= 20)
       You pay 20 bucks and buy the tanktop.
   *else
       You don't have enough money to buy it.

On CS it wouldn’t work because of the requirement of having a *goto at the end. You would need to do this:

   *if (money >= 20)
       You pay 20 bucks and buy the tanktop.
       *goto afterTanktop
   *else
       You don't have enough money to buy it.
       *goto afterTanktop

*label afterTanktop

As you can see, that’s redundant since the code could just continue down. By using implicit control flow, you don’t need to add this *goto and *label, the first example would work.


More info here:

6 Likes