What does 'foo' really mean?

前端 未结 9 1471
无人及你
无人及你 2020-11-30 16:39

I hope this qualifies as a programming question, as in any programming tutorial, you eventually come across \'foo\' in the code examples. (yeah, right?)

what does \'

9条回答
  •  北海茫月
    2020-11-30 17:01

    foo is used as a place-holder name, usually in example code to signify that the object being named, or the choice of name, is not part of the crux of the example. foo is often followed by bar, baz, and even bundy, if more than one such name is needed. Wikipedia calls these names Metasyntactic Variables. Python programmers supposedly use spam, eggs, ham, instead of foo, etc.

    There are good uses of foo in SA.

    I have also seen foo used when the programmer can't think of a meaningful name (as a substitute for tmp, say), but I consider that to be a misuse of foo.

提交回复
热议问题