# Metasyntactic variable

 related topics {math, number, function} {language, word, form} {work, book, publish} {style, bgcolor, rowspan} {food, make, wine} {film, series, show}

In computer science, programmers use metasyntactic variables to describe a placeholder name or an alias term commonly used to denote the subject matter under discussion or an arbitrary member of a class of things under discussion. The use of a metasyntactic variable is helpful in freeing a programmer from creating a logically named variable, which is often useful when creating or teaching examples of an algorithm. The word foo is the principal example.[1]

The term "metasyntactic variable" is primarily found in informal literature. It is sometimes also used as a synonym for metavariable.

Any symbol or word which does not violate the rules of the language can be used as a metasyntactic variable, but nonsense words are commonly used. The same concept is employed in other fields where it is expressed by terms such as schematic variable (see logical form).

By mathematical analogy: A metasyntactic variable is a word that is a variable for other words, just as in algebra letters are used as variables for numbers.[1]

## Contents

### Etymology

• 'Meta' means providing information about, or transcending.
• 'Syntax' means the grammatical arrangement of words or the grammatical rules of a programming language.
• 'Variable' means something that can assume a value, or something likely to vary.

So we have a word that

or one that

### Words commonly used as metasyntactic variables

A "standard list of metasyntactic variables used in syntax examples" often used in the United States is: foo, bar, baz, qux, quux, corge, grault, garply, waldo, fred, plugh, xyzzy, thud.[1] The word foo occurs in over 330 RFCs and bar occurs in over 290.[2] Wibble, wobble, wubble and flob are often used in the UK.[3]

### Programming language examples

The C programming language: In the following example the function name foo and the variable name bar are both metasyntactic variables. Lines beginning with // are comments.