Can anyone please tell me what foo is for. I have been trying to find out for ages.
Is foo just used to demonstrate a piece of code?
Or does it have a specific use.
Any help would be much appreciated.
Regards,
Nick.
| SitePoint Sponsor |
Can anyone please tell me what foo is for. I have been trying to find out for ages.
Is foo just used to demonstrate a piece of code?
Or does it have a specific use.
Any help would be much appreciated.
Regards,
Nick.
foo is the first of the metasyntactic variables which is a fancy way of saying that it is a generic placeholder name for a variable. Other examples are foo, bar, foobar, quux (although for some reason I like to use my own "zoot").
more on the metasyntactic variables
http://www.tuxedo.org/~esr/jargon/ja...tic%20variable
more on foo
http://www.tuxedo.org/~esr/jargon/jargon.html#foo
Another scheme of metasyntactic variables that you often come accross for examples of strongly typed languages is:
myInt = 1;
myString = "foo";
myCat = new Cat;
Some people will just use:
var1, var2, var3, etc...





foo is just something most programmers use as general variable names.
it really has no significance.
Stuff like $row, $sql, etc.. are used as well.
a variable name is just that: a name.





Thanks for clearing up exactly what freakysid just posted![]()
Please don't PM me with questions.
Use the forums, that is what they are here for.





i know that's what he posted.
and i reposted it just like that because i thought it'd be easier to understand.
Thanks Guys,
To be honest, foo has been driving me crazy.
At least I know now my foo's from my foobars.
Cheers
Nick.
Bookmarks