« Back to Glossary Index

As in, “to nest code”. This is what it’s called when you put one programming construct, such as an if statement, inside of the block of another statement, like another if statement or a menu, typically via indentation.

For example:

    "You went for a walk.":
        if owns_dog:
            "You took your dog with you on a leash."
            "You grabbed a jacket on your way out."
    "You watched some TV":
        "You ended up watching a cooking show."

In this example, the if statement is nested inside of the menu statement. Informally, you can see that this is the case because of the extra levels of indentation – the choice menu is already indented, and then the conditional/if statement is indented one further level inside of that.

« Back to Glossary Index