« Back to Glossary Index

Empty space at the start of a line that helps indicate the relationship between lines of code. By default, one level of indentation in Ren’Py consists of 4 spaces.

For example, consider the following code:

label start: # No indentation
    "This line is indented one level to the right." # One level
    menu: # One level
        "Choice 1": # Two levels
            pass # Three levels
    return # One level

In the code above, line 1 is not indented at all; there are no spaces separating it from the leftmost border. The dialogue "This line is indented one level to the right" on line 2 is, as described, one level to the right underneath label start. Similarly, lines 3 and 6 are also indented one level. The choice "Choice 1" on line 4 is indented two levels. There are 8 spaces (4*2) at the start of the line. pass on line 5 is indented three levels; there are 12 spaces at the start of the line.

You may also notice that the places where the code is indented one more level than the code above it occur after a line that ends with a colon :. This is an important property of Python and Ren’Py code; colons create something known as a block, which groups the code underneath it in special ways. It’s very important to use indentation and blocks properly so Ren’Py can read your code.

« Back to Glossary Index