-1

In many program test case or example case, i always see "bar" and "foo", what is the two word represent for and why choose this two words as example?

Nick Bondarenko
  • 6,211
  • 4
  • 35
  • 56
rench
  • 57
  • 1
  • 6
  • 1
    Wikipedia: [Foobar](https://en.wikipedia.org/wiki/Foobar). – peterSO Jan 22 '16 at 08:30
  • Based on [wiki](https://en.wikipedia.org/wiki/Foobar) these are variables whose name is not important... This question could be considered out of topic, but is definitely programming related and a good one :) (every beginner wonders at some point) – urban Jan 22 '16 at 08:30
  • They are called *metasyntactic variables*. The etymology of `foo` and `bar` are uncertain. See https://en.wikipedia.org/wiki/Metasyntactic_variable – Bathsheba Jan 22 '16 at 08:39

1 Answers1

3

Google can answer your question far better than I. From wiki:

The word foo originated as a nonsense word from the 1930s, the military term FUBAR emerged in the 1940s, and the use of foo in a programming context is generally credited to the Tech Model Railroad Club (TMRC) of MIT from circa 1960.[9] However, the precise relationship of these terms is not known with certainty, and several anecdotal theories have been advanced to identify them.

Also, have a look at this question: What is the origin of foo and bar? as well as this one: https://softwareengineering.stackexchange.com/questions/69788/what-is-the-history-of-the-use-of-foo-and-bar-in-source-code-examples

Community
  • 1
  • 1
Derlin
  • 9,572
  • 2
  • 32
  • 53