Switch by Zed Lopez


Doesn't fall through. Sorry, Duff's Device fans.

If you include a default case, it must be the last thing.

Chapter Changelog

2/220329 cleanup, no longer track kind in state array, use fewer temp vars

Example: * Switch

"switch"

Include Switch by Zed Lopez.

Lab is a room.

xyz is initially 3.

To decide what text is switchcat (T - a text):
if switch T begin;
if / "dog" /, decide on switchcat "cat";
if == "cat" begin;
if switch xyz begin;
if range 4 to 8, decide on "blue";
if range 2 to 3, decide on "red";
if > 5, decide on "moo";
if < 4, decide on "baa";
if == 3, decide on "yow";
if default case, decide on "blah";
end if;
end if;
if / "c.t?" /, decide on "meow.";
end if;
decide on "?";

when play begins:
if switch 2 begin;
if == 1, say "yow!";
if < 3, say switchcat "dog";
if default case, say "nothing.";
end if;