A metasyntactic variable is a specific word or set of words identified as a placeholder in computer science and specifically computer programming. These words are commonly found in source code and are intended to be modified or substituted before real-world usage. For example, foo and bar are used in over 330 Internet Engineering Task Force Requests for Comments, the documents which define foundational internet technologies like HTTP (web), TCP/IP, and email protocols.
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.
Metasyntactic variables are used to name entities such as variables, functions, and commands whose exact identity is unimportant and serve only to demonstrate a concept, which is useful for teaching programming.
Due to English being the foundation-language, or lingua franca, of most computer programming languages, these variables are commonly seen even in programs and examples of programs written for other spoken-language audiences.
The typical names may depend however on the subculture that has developed around a given programming language.
Metasyntactic variables used commonly across all programming languages include foobar, foo, bar, baz, , , , , , , , , , and thud; several of these words are references to the game Colossal Cave Adventure.
A complete reference can be found in a MIT Press book titled The Hacker's Dictionary.
In Japanese, the words (ほげ) and fuga (ふが) are commonly used, with other common words and variants being piyo (ぴよ), (ほげら), and (ほげほげ). The origin of as a metasyntactic variable is not known, but it is believed to date to the early 1980s.
In France, the word toto is widely used, with variants tata, titi, tutu as related placeholders. One commonly-raised source for the use of toto is a reference to the stock character used to tell jokes with Tête à Toto.
In Turkey, the words hede and hödö (usually spelt hodo due to ASCII-only naming constraints of programming languages) are well-known metasyntactic variables stemmed from popular humorous cartoon magazines of the 90's like LeMan.