4 ms·
Real talk: is the comma in “hello, world!” necessary?
by sbilstein 7y ago
Real talk: is the comma in “hello, world!” necessary?
- gibolt 7y agoDepends on your intent. If you are referencing a world when everyone can only say "Hello", the comma may be removed
- ganstyles 7y agoYeah! And while we're on the subject, is the ", World" even necessary?
- sk0g 7y agoTraditions are traditions, and an industry as young as ours needs to hold on to the very few we have! Moving goalposts around on the Hello World code golfing world has some 'consequences' - there's languages with built in hello world that try and get it printing with minimal code, and removing the comma, for example, would invalidate that hack.
- superasn 7y agoOne tradition I'm happy got lost in the way is using FOO, BAR, BAT in examples. It made the simplest examples hard to understand and those words never made any sense to me. It's always better to use contextual words in most examples. edit: for more clarity this article (1) explains it quite well https://dev.to/kiarathedev/why-i-don-t-use-foo-bar-baz-1kf7 https://dev.to/kiarathedev/why-i-don-t-use-foo-bar-baz-1kf7
- sk0g 7y agoI'd honestly rather have a,b,c than that! Nobody writes code with such placeholder variable names, so why demonstrate it that way? Placeholder variables like i and j don't count! Foo, Baz, etc are annoying to read too, IMO.
- runarberg 7y agoI use foo, bar, baz, etc. all the time when I’m writing tests. But I agree generally it is better when examples use meaningful name `cd /path/to/file` as oppose to `cd /foo/bar/baz`
- kunglao 7y agoWhat's wrong with FOO? It's fun to say and can use it almost anywhere when you need a random word. Has saved me seconds here and there when I didn't need to think of a word because I have FOO :)
- jfengel 7y agoIt's cute. "Hello" is just greeting the programmer, as if it were one person to another. "Hello, world" is like a new baby introducing itself to a planet. It's both tiny and momentous; the contrast is humorous. That feels friendly. Especially viewed in its original context, introducing a new programming language (C) to a planet that wasn't quite as crowded with programming languages as it is today. Since then it's just tradition. Feel free to leave it out. But it's iconic for a reason.
- emptybits 7y agoHello, sbilstein! ;-) It's considered grammatically correct. > When the salutation in your letter or email starts with Hello or Hi, then you should put a comma before the name of the person you're addressing. It is also standard practice to put a comma after the name of the person you're addressing. ... You could also use an exclamation mark if you wanted to emphasize an emotion (like surprise). [1] [1] https://www.grammar-monster.com/lessons/comma_with_dear_hello_and_hi.htm https://www.grammar-monster.com/lessons/comma_with_dear_hell... I'm not an expert but I've always seen it written this way and plenty of other sources suggest this practice. e.g. https://www.grammarly.com/blog/comma/ https://www.grammarly.com/blog/comma/
- Stratoscope 7y agoModern English usage does not pay much attention to the traditional ideas of being grammatically correct. The trend today is to omit needless punctuation. In the case of "Hello, world!" vs. "Hello world!", there is no one who would be confused by either version. The comma does not change the meaning at all, so you can include it or omit it as you prefer. But take a look at one example of modern usage. If your name is Mike (like mine), which would you be more likely to see at the beginning of an email: Hi, Mike, or: Hi Mike, Pretty sure it will be the latter. In fact I can't remember the last time I saw this salutation with a comma. (Edit: after writing that, I noticed that my last sentence is an example of what I'm talking about. I think the "grammatically correct" version would be "In fact, I can't remember..." - but many writers today would leave out that unnecessary comma.) Edit 2: Hello, downvoter! ;-) Gosh, does anyone write like that any more? It seems so archaic. See, the thing about the comma is that it isn't a question of being "grammatically correct" or not. The purpose of the comma in modern English is to show where you would pause when speaking. Which way would you pronounce it? "Hello world" just like any other two words in a row? Or "Hello <pause> world"? The way you pronounce it is what should inform you about whether you write the comma or not.