Programs within Programs🔗

subprograms, modular, nested, function, call, run, execute

Sometimes it is easiest to use multiple GT programs that refer to each other. Let's say you have a program called "How to take a bath" and another program called "How to wash behind your ears." You may want your "How to take a bath program" to also contain instructions for washing behind the ears. But rather than rewrite some of the program, or copying and pasting one into the other, you can run the "How to wash behind your ears" program directly from within the "How to take a bath" program. Here's an example:

After you've sufficiently scrubbed your tongue, you'll need to work on your ears. Naturally, the most important section is the bit behind the lobes.

Now, I'm going to teach you about how to wash behind your ears.

*program: How to wash behind your ears

Great, now that we're done with your ears, grab some shampoo and get ready to lather those eyebrows.

In the above example, users will see the text "After you've..." and immediately following it on the same screen they will also see whatever is contained within the "How to wash behind your ears" program. After this program ends, the users will then be able to see "Next, grab some..."