### 2.19 Organizing larger pieces

When all of the elements discussed earlier are combined to produce larger files, the `\score` blocks get a lot bigger, because the music expressions are longer, and, in the case of polyphonic pieces, more deeply nested. Such large expressions can become unwieldy.

By using variables, also known as identifiers, it is possible to break up complex music expressions. An identifier is assigned as follows

         namedMusic = \notes { ...

The contents of the music expression `namedMusic`, can be used later by preceding the name with a backslash, i.e. `\namedMusic`. In the next example, a two note motive is repeated two times by using variable substitution

>          seufzer = \notes {
>            e'4( dis'4)
>          }
>          \score {
>            \new Staff { \seufzer \seufzer }
>          }

The name of an identifier should have alphabetic characters only; no numbers, underscores or dashes. The assignment should be outside of the `\score` block.

It is possible to use variables for many other types of objects in the input. For example,

         width = 4.5\cm
         name = "Wendy"
         aFivePaper = \paper { paperheight = 21.0 \cm }

Depending on its contents, the identifier can be used in different places. The following example uses the above variables

         \score {
           \notes { c4^\name }
           \paper {
             \aFivePaper
             linewidth = \width
           }
         }

More information on the possible uses of identifiers is in the technical manual, in TODO.

Read comments on this page, or add one. This page is for LilyPond-2.2.2 (stable-branch).