Quitting a user's run 🔗

exit, stop, end, finish

You can cause the user's run to end wherever and whenever you like. When inserting the *quit keyword, users won't be able to see any line of text or keyword that may follow it.

For instance:

You're reading a line of text.
*quit
But you can't see this second line of text because the program has quit.

Users taking this program will only be able to see the first line of text. The second will be invisible because nothing is ever displayed below a *quit keyword that a user has hit.

The *quit keyword may be especially useful in multiple choice options, where one option causes the program to end and the other allows it to continue. This example was used earlier in our introduction:

*question: Which of these animals is least awesome?
	Goat
		So, you're hating on goats
		*question: What have goats ever done to you?
	Fish
		Fish disfavorer! Get out of my face.
		*quit

Now for something completely different.

▶ Run

In this case, if the user selects the answer "Goat," they'll next see the text "So, you're hating on goats" and then they'll be asked the question "What have goats ever done to you?" Once the user answers, the text "Now for something completely different." will be displayed to them.

If instead of selecting "Goat" the user selected "Fish," they would see the text "Fish disfavorer! Get out of my face." and then the program would immediately (with no delay) stop running due to *quit being reached. The phrase "Now for something completely different." would not be displayed to the user, due to the *quit keyword causing the program to exit this GT run immediately.

The *quit keyword quits an entire run, even when it occurs in a program that's embedded in another program.


Next: