Talk:"Hello, world!" program/Archive 1

From Wikipedia, the free encyclopedia
Jump to: navigation, search
The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.

Contents

"To run:" recipes unneccessary

Should all this "to run:" crap really be in the 'Hello world program' article? We don't seriously expect everybody to have a GNU/Linux system with complete development environment installed. --Jizzbug

You mean posix environment? Well, it is the official standard. ;-) Kim Bruning 22:03, 17 Jul 2004 (UTC)

XHTML Warning

The following notice was attached to the XHTML example:

Please note that this document must also be sent with the appropriate HTTP Header, most preferably "application/xhtml+xml", but it MAY also be sent as "application/xml" or "text/xml"; however it MUST NOT be sent as "text/html"; see XHTML Media Types for further info.

I removed this, as on http://www.w3.org/TR/xhtml-media-types/#text-html (the section just above the one referenced), there is a backward compatibility clause that renders it unnecessary to make any relevant point here. This also matches my experience with 100's of XHTML documents on web servers and various browsers. --Nigelj 20:19, 15 Nov 2004 (UTC)

Indeed, I would have to agree - while it is technically correct to use that doctype, it's going a bit far to impose it upon everyone when text/html is set so rigidly into some systems that it may never change... -[Unknown] 21:13, Nov 15, 2004 (UTC)
That clause is applicable to XHTML 1.0, not 1.1. —Ævar Arnfjörð Bjarmason 15:19, 17 July 2005 (UTC)
Yeah, the W3C, upon realizing the error of their ways, removed the backwards-compatibility section. It goes totally against the whole idea of using XML instead of SGML. If you limit yourself to being backwards-compatible with HTML 4.01, why not just use it? There is a great page describing all the problems with XHTML being sent as text/html at Web DevoutWulf 20:10, 27 July 2006 (UTC)

Hello world tradition (BCPL)

The tradition of using "Hello world!" as the test message was probably started by its use as an example program in the book The C Programming Language, by Brian Kernighan and Dennis Ritchie.

I think so too, but somone (not me!) on the BCPL page claims it started in BCPL. --drj
(ext lk) http://cm.bell-labs.com/cm/cs/who/dmr/bintro.html
In 1997, Dennis Ritchie says: 'so far as Brian and I can remember, the Tutorial contains the first instance of a "Hello, world" program.' The Tutorial in question is (ext lk) http://cm.bell-labs.com/cm/cs/who/dmr/btut.html . It is for the B programming language, and was published internally at Bell Labs in January 1973. The program could be even older (the Unix people had switched to C for almost everything by then; the heyday of B on Unix was perhaps 1970-71). But January 1973 is the earliest surviving evidence. This is a few years before "The C Programming Language" book, and obviously a precursor to it, since the same people are involved.
It would be interesting to hear more details of the BCPL claim. BCPL is the main inspiration for B, so it is possible someone doing B had seen the hello world in BCPL and "translated" it. Ritchie and Kernighan 24 years later would not necessarily remember this. On the other hand, it is possible some later reporter heard that hello world was invented in B and misreported this as BCPL. We need more details of the BCPL claim, preferably including a date.

Java Swing example

The Java Swing example is excessively long. It should only be a half-dozen lines longer than the console example. Ed Poor

Good point. I'll put up a more reasonable one. The other option is to not have a GUI one at all, but I'll probabl lose that argument. --LDC

IMO i think it should be the most basic way of doing hello world, without any fancyness such as a gui, so yes, put the CLI one there. --Ævar Arnfjörð Bjarmason 23:43, 2004 May 5 (UTC)

"Evolution of a Programmer" joke

Would it be terribly off topic to include all the "Hello world!" examples from the old Evolution of a Programmer joke, possibly as a subpage? I don't want to go to the trouble of looking it up and copying it if it's just going to get deleted as off-topic.

It's really not on topic, so someone will likely remove it. --Stephen Gilbert

Java GUI example

The "Java GUI" example seems excessively long. Did someone put that in there on purpose, to make the point that Java is a verbose language? I put in a 5-line Java applet example in rebuttal, if that was their purpose. -- User:Ed Poor

I put that one in, and for the same reason: whoever put in the original "Java GUI" example put in one that was three times as long, made it look like Java GUI programming is a real mess. I shortened it down to the current version, which really is about as small as you can get a standalone Java GUI appication. Of course applets can be even smaller, because they aren't standalone--they depend on an enclosing application. --Lee Daniel Crocker
The 6502 (comparably simple system) example too depends on an "enclosing application": the "KERNAL ROM" whose charoutput subroutine is called. Similarly a java applet with just a paint() function would establish a hello world GUI example. If one is very picky, the according .html file got to be listed because it defines the size of the display. But on the other hand, other examples to might need "make" (or such) files that the reader would need to really get the hello world sample running on the system in question, but are not listed. -26.9.2005
import java.applet.*;
import java.awt.*;
public class hello extends Applet {
        public void paint(Graphics g) {
                g.drawString("Hello World!",20,20);
        }
}


I took out the following, because it's not a Hello, world program. No one would use code as long and complex as this to test whether their compiler is working. Java always comes with the Appletviewer, which would run the 5-line program I supplied. Java program are rarely stanalone, in that they require the JVM to run. Likewise a VB program requires 6 MB or more of runtime DLLs and EXEs to run, and all Windows GUI programs require the Windows API to run. User:Ed Poor
I'm putting it back, because your exlanation here is mostly wrong. Most JVMs /do not/ come with "appletviewer": Sun's do, but there are lots of others that don't (For example, I use GCJ, a Java native compiler, that doesn't). Also, "Hello world" programs are frequently used to test more than just basic compilers, but also libraries and APIs: it is quite common to test a communications library by sending a "Hello world" message, or test a GUI library by drawing a "Hello window". This program really is a good example of GUI programming in Java, and is far simpler than a GUI program would be using many C libraries. It might look better compared to something like a Windows GUI "Hello world", or a GNOME "Hello world". Maybe those could go into a separate section?
And a lot of 6502 do not come with the "KERNAL ROM" but with something else. Similar argument with many of the examples. -26.9.2005


Yes, thanks. Thus the selfish Java meme propagates itself. User:Ed Poor
Hi, I've cut the GUI (non-applet) version to 6 lines. It doesn't rely on an applet window. Hope this is satisfactory? Ben Arnold 23:30, 25 Mar 2004 (UTC)
I've cut it back now to 5 lines (one statement with the surrounding method and class definition). Apparently the System.exit(0) call was unnecessary. I'm sure I tried doing without it when I first submitted the program. It's possible that in an earlier JDK showMessageDialog wasn't disposing the dialog or that the JVM didn't use to terminate when all windows were disposed... but it's more likely I was just wrong the first time. Ben Arnold 13:26, 19 Feb 2005 (UTC)

Brainfuck example

I just replaced the brainfuck example with a more concise one written by Urban Müller, who made brainfuck. -Daniel.

Can't find the Brainfuck example? --130.243.83.141 17:20, 23 January 2006 (UTC)
Yeah, where is the brainfuck example?
It seem to have been moved to Hello world program in esoteric languages. --I hate to register 22:48, 24 January 2006 (UTC)

C example mess-up

Jizzbug messed up the hello world C program about a month ago - he removed the return statement (required in classic ANSI C) and the return type of main (required in C99 / ANSI 2000). I have corrected this, but he also modified the programs for several other languages, and may well have damaged these too; it would be useful if people who know these languages could check that all is well. --Zundark 18:10 Feb 5, 2003 (UTC)

Shell script interpreter call

I wonder if it's a good think to keep the comment calling the interpreter (like #!/usr/local/bin/perl). It's specifically unix and there is a way to run the program without this comment. Ericd 23:54 Apr 25, 2003 (UTC)

I think they should be removed. --Zundark 08:34 Apr 26, 2003 (UTC)

Hello world string tradition

From the Wiki article:

"the tradition of using "Hello, world!" as the test message
 was probably started by its use as an example program in
 the book The C Programming Language, by Brian Kernighan
 and Dennis Ritchie."

If you actually look at what that book published, you find not "Hello, world!" but "hello, world" . Why do we use the modified form in this Wiki article? - Bevo 12:33, 17 Aug 2003 (UTC)

SQL example

Is this not valid SQL?:

SELECT 'Hello, world!' AS Greeting;

It works at least in PostgreSQL and mySQL, and avoids the creation and destruction of an unnecessary table. --FOo 12:57, 5 Sep 2003 (UTC)

I don't think so, in Oracle you need something like:

SELECT 'Hello, world!' AS greeting FROM dual;

but I don't believe that's ANSI SQL either. OTOH there are various methods like temporary tables which may be "better". Lady Lysine Ikinsile 04:01, Jun 8, 2004 (UTC)

Yes, technically you should do this for ANSI SQL:

CREATE TEMPORARY TABLE helloworld (
  example varchar(16)
);
 
INSERT INTO helloworld
VALUES ('Hello, world!');
 
SELECT example
FROM helloworld;
 
DROP TABLE helloworld;

It's a bit roundabout, but the SELECT xyz; extension, while nice, is proprietary.

-[Unknown]

Embedded literal strings

There is presently a long rant on this page about how all the example programs have embedded text and this is bad practice because such strings cannot be automatically replaced by translations into the user's native language. This is factually inaccurate (some environments allow translation of embedded strings, others do not) and non-NPOV (whether not string separation is good practice is controversial, but it's presented here as universally agreed).

I tried to rework the rant into a brief mention of the issue and a cross reference to Internationalization, where the topic chould be discussed more evenly and at length, but I cannot make it brief without making it unclear. And I'm wondering whether this is an appropriate place to mention this at all. The more I think about it, the more totally offtopic this seems. Thoughts?

Zack 06:19, 10 Sep 2003 (UTC)


Well said, Zack. It would be hard to work that other topic in appropriately with this topic.
I killed it. Zack

GTK / Windows API examples

Is the GTK exemple serious ?

Ericd 08:57, 13 Sep 2003 (UTC)
It's not the canonical GUI "hello world" program in my book, but tastes may differ. (The way I learned it, a GUI "hello world" is supposed to pop up a window showing that text, and obey the standard quit commands for that GUI -- it may or may not have a quit pushbutton too.)
Zack 04:16, 14 Sep 2003 (UTC)
The standard "hello world" app for the Windows API that I've seen is similar also. According to Petzold (via [1]): "The original hello-world program in the Windows 1.0 SDK was a bit of a scandal. HELLO.C was about 150 lines long, and the HELLO.RC resource script had another 20 or so more lines... Veteran C programmers often curled up in horror or laughter when encountering the Windows hello-world program". I have a textbook with a Windows API hello-world spread over 3 source files plus a header file -- one for WinMain and the message loop, one for initialising the class and the window, and one for the paint procedure. The program creates a proper overlapped window, with "Hello world" in the client area. Using MessageBox() really is cheating. -- Tim Starling 04:42, Sep 14, 2003 (UTC)
We should decide about appropriateness of using cheats (e.g. MessageBox()) at all. -- Xrgtn 14:46, 25 October 2005 (UTC)
Is this good? After seeing your comment I was going to put it in, but I was afraid someone would change it right back...
   #include <windows.h>

   LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM);

   char szClassName[] = "MainWnd";
   HINSTANCE hInstance;

   int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
   {
     HWND hwnd;
     MSG msg;
     WNDCLASSEX wincl;

     hInstance = hInst;

     wincl.cbSize = sizeof(WNDCLASSEX);
     wincl.cbClsExtra = 0;
     wincl.cbWndExtra = 0;
     wincl.style = 0;
     wincl.hInstance = hInstance;
     wincl.lpszClassName = szClassName;
     wincl.lpszMenuName = NULL; //No menu
     wincl.lpfnWndProc = WindowProcedure;
     wincl.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); //Color of the window
     wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION); //EXE icon
     wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION); //Small program icon
     wincl.hCursor = LoadCursor(NULL, IDC_ARROW); //Cursor

     if (!RegisterClassEx(&wincl))
           return 0;

     hwnd = CreateWindowEx(0, //No extended window styles

           szClassName, //Class name
           "", //Window caption
           WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX,
           CW_USEDEFAULT, CW_USEDEFAULT, //Let Windows decide the left and top positions of the window
           120, 60, //Width and height of the window,
           NULL, NULL, hInstance, NULL);

     //Make the window visible on the screen
     ShowWindow(hwnd, nCmdShow);

     //Run the message loop
     while (GetMessage(&msg, NULL, 0, 0))
     {
           TranslateMessage(&msg);
           DispatchMessage(&msg);
     }
     return msg.wParam;
   }

   LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
   {
     switch (message)
     {
     case WM_CREATE:
           CreateWindow("STATIC", "Hello, world!", WS_CHILD | SS_NOTIFY | SS_SIMPLE | \
                        WS_VISIBLE, 15, 10, 80, 20, hwnd, NULL, hInstance, NULL);
           break;
     case WM_DESTROY:
           PostQuitMessage(0);
           break;
     default:
           return DefWindowProc(hwnd, message, wParam, lParam);
     }
     return 0;
   }
- Evil saltine 05:29, 14 Sep 2003 (UTC)
Why does that create two windows? Or am I confused? I don't know Windows GUI programming at all. Would a programmer really write all that, or would they use a higher level "toolkit" library to do the grunt work?
Anyhow, I wonder if there should be a separate page for GUI hello world programs. They do tend to be much longer than the simple "print text" variety, and are not really examples of programming in a given language. They are instead examples of programming to a given API (which may or may not imply a language; Tk for instance can be used from several different languages).
Zack 17:32, 14 Sep 2003 (UTC)
One "window" is the actual window, and the other is the text. That's the way it would probably be written... but I don't know for sure.
Evil saltine 21:02, 14 Sep 2003 (UTC)
In my experience, a toolkit is usually used (although they're not called toolkits). Microsoft's MFC is the most popular, although personally I'm more familiar with VCL. Both are basically wrappers, they don't provide significant functionality like GTK does. Yes, there are two windows: one overlapped parent window and a static text child window. MS Windows programmers have a different definition of the word "window" to ordinary people: controls such as buttons, text boxes, etc. are actually child windows. The hello world program I was referring to didn't create two windows like that, it just used TextOut in response to WM_PAINT. -- Tim Starling 07:51, Sep 15, 2003 (UTC)

More (sub)sections suggested

I suggest we create a (sub)section "Script languages", and perhaps others, to make the article a little more navigable. I'll work on this if no one else does and not too many strongly discourage it. --Wernher 06:22, 17 Dec 2003 (UTC)

Hmmm, let me try to squeeze in another line in this heated discussion. :-) To tidy up the article I also suggest "Assembly languages" to be a section instead of it being a subsection under Line-oriented languages. No protests => 'do it'. --Wernher 21:38, 10 Feb 2004 (UTC)

PostScript example variant

Postscript: Hello world with shadow.

(Hello world)
/Times-Roman findfont setfont 300 50 moveto [0 100 -100 0 0 0] concat /X
{gsave .01 setlinewidth dup stringwidth pop .2 add dup neg exch 0 0 -1 4
-1 roll 0 0 1 rlineto rlineto rlineto rlineto stroke grestore .1 .2 rmoveto
dup show} def gsave [1 0 2 -.8 0 0] concat .8 setgray X grestore X showpage

(forgot to sign)

I don't undertand why PostScript is under "File Formats" and not unter programming languages. This is clearly a programming language! Not at all at the same sige than HTML or even RTF! The same is true about LaTeX. MFH: Talk 18:04, 24 Jun 2005 (UTC)

Romanian pseudocode esoteric?

I wonder if the Romanian pseudocode example should rather be placed in the Hello world program in esoteric languages article instead? "Romanian pseudocode" certainly sounds quite esoteric to me, but then again I'm not from Romania... --Wernher 21:44, 10 Feb 2004 (UTC)

MSDOS example too long

The MSDOS command could just be "@echo Hello, world!" There's no reason for turning echo off on a one line batch script.

OK. Please, "be bold" and edit it. Bevo 21:03, 24 Feb 2004 (UTC)

YaBasic advocacy

"To whom it may concern": please take no offence, but there is absolutely no new information gained by including "Hello world" written in YaBasic as long as we already have a section on Structured BASIC; there's a whole lot of BASICs out there where the Hello world program would look exactly the same -- so we include only a sampling of the most well-known ones. --Wernher 09:54, 3 Apr 2004 (UTC)

maybe list variations on languages where the things look the same under the earliest of the genre? e.g.,
     ... panadaCalc ...
     growl 'helloWorld'
     Also, HoarseFelineCalc, BearCalc, machoMaleCalc.
Er -- I'm not quite sure what to make of this, lest it be some sort of humorous(?) comment? --Wernher 20:01, 3 Apr 2004 (UTC)
Well… some sarcasm maybe, but Anonymous' point is valid. If the "hello world" program is identical in languages X and Y, don't include two programs. Instead include just the X program with the annotation "Also Y." Makes sense, don't you agree?
Herbee 21:12, 2004 Apr 3 (UTC)
Ah, now I understand *blush*; thank you. Yes, the point is absolutely valid -- too bad I didn't see at first reading what Anon. was trying to say. For a language with many similar dialects, such as BASIC, a typical listing of variations might be a general reference to e.g. "Microsoft BASIC". --Wernher 21:58, 3 Apr 2004 (UTC)

HyperTalk Example

HyperTalk is the programming language behind HyperCard, the popular "stack" programming tool for the Macintosh during the '90s (and in limited use today).

on openStack
  answer "Hello, World!"
end openStack

'open stack' could be any handler, but makes the most sense in a "Hello, World!" example since a stack is really an entire program in HyperCard.

(HyperCard will automatically format control blocks with each indent being, I believe, two spaces.)

Color-coding of hello world programs

User:Rrjanbiah who seems to be a large fan of the -s option of php(1) he has recently color coded the Hello world program article to look something like this example of C and C++ and this example of Perl and PHP.

While i agree that readability of these code examples is of the essence i think something like this just crosses the line, first of all it is highly unportable so people would have to run around manually syntax highlighting everything that the php parser doesnt read, second of all the html code produced by said parser can only be horrendous, and third of all it does not follow the Wikipedia:Manual of Style,

In the meantime i have reverted the article to it's former state and notified User:Rrjanbiah, he can respond below this line if he disagrees/has anything to add, then we can hold a vote on this. --Ævar Arnfjörð Bjarmason 00:25, 2004 May 6 (UTC)


I've checked the manual of style, and couldn't find a clear policy on this, so I started a discussion at http://en.wikipedia.org/wiki/Wikipeda_talk:Manual_of_Style#Syntax_highlighting_for_source_code.

Before thinking of voting, these days it's called a survey. See: http://en.wikipedia.org/wiki/Wikipedia:Survey_guidelines . But best if this were discussed on the talk for manual of style first. Kim Bruning 22:35, 17 Jul 2004 (UTC)

PHP Example

I corrected the

Hello World!

to

<?php echo "Hello World!"; ?>

The former just can't be right, because the text outside of <?php ?> tag-pairs is not interpreted by the PHP-engine and if you put the text "Hello World" inside the tags without echo or print, then you just get an error.

It is, technically, correct. Text outside of <?php ?> is passed, through unmodified. For example:
15> cat >hello.php
Hello, world
^D
16> php hello.php
Hello, world
17>
However, given that the idea is to demonstrate the basic structure of the language (IMHO), I think the more complex example is more useful. Lady Lysiŋe Ikiŋsile | Talk 23:29, 2004 Jul 15 (UTC)

I changed primary PHP example back to

Hello, world!

and put

<?php
echo "Hello, world!\n";
?>

in as a secondary example, the reason for this is that each Hello world example should display the simplest way to print "Hello, world" using the language, and printing and ignoring everything outside <?php ?> tags is a feature of php, and thus the simplest way to print "Hello, world" is the first example above. —Ævar Arnfjörð Bjarmason 23:50, 21 July 2005 (UTC)

The title

Clicking on "Hello world" program leads to an appropriately named edit window for that page, so surely moving the article there (i hasten to add, using the Move link, not cutting and pasting into the window i provided by that link) will produce the desired result. The present title is contrary to the in-line-text usage of the article, & bad English syntax. (Why would anyone say hello to a world program, whatever that is?) Unless i've missed a prohibition in the WP:MOS, i intend to rename this page's article in that way. --Jerzy(t) 22:31, 2004 Jul 29 (UTC)

Uselessness of various alternates

There are certain various useless alternate examples that I'm removing. Python has two examples, one showing that you can use the sys object to produce output. Rexx demonstrates that you could use single or double quotes for the string. This is not useful. In the languages I'm more familiar with (Perl and Ruby) there are several ways of expressing strings, and there are several ways of getting data to STDOUT. I'm sure many other languages have their slight variations on these themes. If we were to apply the treatment Python and Rexx have received to every language on the list, the page would become three times as large and ten times as annoying. In the interest of consistency, I'm trimming off some of this stuff. --Yath 21:46, 14 Aug 2004 (UTC)


I agree! It seems quite silly that an article on the hello world program should now be approching the 32k range. I'd like to offer a suggestion, where we refactor the article in such a way that the one-liners don't have to take up so much real estate... Um, I was going to be bold, but I was fairly sure someone would just immediate revert, so I present it here on the talk page:


One Liners

Here is a listing of those languages where "hello world" is a simple one-liner, that is, where a literal-notation for the string "hello world" is generally preceeded or followed by a single command to either send the string out to a console or to a graphical user interface, such as a dialog box:
           WRITE "Hello, world!"                    ABC
          trace ("Hello, world!")                   ActionScript
                 'Hello, world!'                    APL
  display dialog "Hello, world!"                    AppleScript
   BEGIN { print "Hello, world!" }                  AWK
     ShowMessage("Hello, world!");                  Delphi,Kylix
         puts(1, "Hello, world!")                   EUPHORIA
            -TYPE Hello, world!                     Focus
               ." Hello, world!" CR                 Forth
         println["Hello, world!"]                   Frink
           print,"Hello, world!"                    IDL
                 "Hello, world!" print              Io
       WriteLine "Hello, world!"                    Kogut
          alert( "Hello, world!" );                 JavaScript
           print [Hello, world!]                    Logo
           print "Hello, world!"                    Lua
               W "Hello, world!"                    M (MUMPS)
           Print["Hello, world!"]                   Mathematica
           print "Hello, world!\n";                 Perl
            echo "Hello, world!";                   PHP
                 'Hello, world!' =>                 POP-11
           write('Hello, world!'),nl.               Prolog
           print "Hello, world!"                    Python
          MsgBox "Hello, world!"                    REALbasic
             say "Hello, world!"                    REXX
            puts "Hello, world!"                    Ruby
        (display "Hello, world!")                   Scheme
   sed -ne '1s/.*/Hello, world!/p'                  sed
                 'Hello, world!' print.             Self
Transcript show: 'Hello, world!'                    Smalltalk
           print "Hello, world!\n";                 SML
          #OUTPUT Hello, world!                     TACL
            puts "Hello, world!"                    Tcl
             put "Hello, world!"                    Turing
            echo 'Hello, world!'                    UNIX-style shell
          MsgBox "Hello, world!"                    Visual Basic
    WScript.Echo "Hello, world!"                    Windows Script Host

So, what does everyone think? func(talk) 04:54, 8 Sep 2004 (UTC)

What about the shebangs? Won't someone think of the shebangs? (And preprocessor directives, if you must.) ... I'm not sure I like this. "That other junk" is pretty important. --Yath 06:33, 8 Sep 2004 (UTC)

My only concern is that such a simple notion as "hello world" doesn't need such a tediously long article. In terms of the assembly languages, the code is really interesting, but in terms of languages where it's more or less just a command and string, what exactly are we trying to show people? All of these examples don't teach us any more about:

  • what hello world is
  • why hello world is used

Nor does it really teach us anything about the differences between these languages. A better way to do that would be to provide a link to 99 Bottles of Beer. func(talk) 16:11, 8 Sep 2004 (UTC)

(William M. Connolley 17:03, 8 Sep 2004 (UTC)) HW is a useful test. To *write* HW doesn't need a long article but to list it for various languages does. We are trying to show people the differences between various languages. Obviously not a full comparison but its useful from the quick-and-dirty POV.

Er, right, and that's what my example does. It shows a quick and dirty example of HW in dozens of languages, without taking up hundreds of lines. Note that I wasn't suggesting removing any language example whatsoever, I just thought that for those languages where it's a one-line affair, we could simplify. (My personal opinion is that HW is the silliest way one could choose to show language differences, but I wasn't advocating removing anything). func(talk) 17:11, 8 Sep 2004 (UTC)

With a basic knowledge of a variety of programming languages, I actually find looking up a 'hello, world' program a simple refresher with regard to syntax of a particular language. so for me, this article is great... thanks to the various authors. --Mysteronald 19:16, 8 Sep 2004 (UTC)
(William M. Connolley 18:47, 8 Sep 2004 (UTC)) Oh, sorry, I misunderstood you. You are proposing to condense the one-liners as above? Fine by me.

I believe that the list of programs does not belong in this article. It should be moved to List of hello world programs or something. I also believe that each entry in that list, as well as the examples retained here, should include all canonical preprocessor directives, shebang lines, etc. The environment in which a language normally operates is an important aspect of the language. In fact, the differences between C's #include <stdio.h> and Perl's #!/usr/bin/perl -w tell you a lot more about these languages than their respective print[f] statements. --Yath 04:46, 9 Sep 2004 (UTC)

I agree. The gigantic list of examples should be moved to List of Hello world programs (redirect with lowercase h), leaving a description of the phenomenon and maybe the original / famous K&R C example. Hairy Dude 01:43, 2 February 2006 (UTC)


We could also make lists :

  • Languages in which   print "Hello, world!" ;   is valid.
  • Languages in which   echo "Hello, world!";   is valid.
  • same with parentheses... MFH: Talk 20:26, 23 Jun 2005 (UTC)

Page too large

The Wiki is giving a page warning. How do we split this thing? Aliter 19:21, 22 Sep 2004 (UTC)

I suggest splitting it into "Hello world program (examples)" [Unknown] 19:33, Sep 22, 2004 (UTC)
I heartily agree with this suggestion. This page has definitely become unwiedly, and it serves two primary purposes. It first, explains what a Hello World program is and its history/origins, then goes on to provide a ton of examples. I do not think that splitting the language examples into different articles between those that are current and 'esoteric' or based on their interfaces would be prudent. These categories may change over time or may become redundant.
No matter what type of splitting occurs, this article will always be large, and that is partly the point. However, a description of Hello World programs in general, and a listing of various examples are two fundamentally different topics. --Inarius 08:59, 7 January 2006 (UTC)

You mean splitting the list of from the description? Though functionally a good think, it will not save us for very long, I expect. The programs take up the bulk of the article anyway. Aliter 19:43, 22 Sep 2004 (UTC)

Make a new page at List of hello world programs or something, move the bulk of them over, and leave a representative example of major programming languages on this page. People will disagree about which programs are major enough to warrant inclusion on this page, but so be it. I'd be bold if I had the time... I suggest you just go ahead. --Yath 21:01, 22 Sep 2004 (UTC)

Another possibility is to leave in this article only the text oriented examples, and move to new articles the 'GUI', 'Document formats', and 'Page Description languages' examples (to follow the same convention that made with the examples in esoteric languages. In fact, I've just deleted the Befunge and Brainfuck examples because they were in the article 'Hello world program in esoteric languages'). -- suruena 09:23, 2004 Dec 21 (UTC)

I very much agree with this idea - Hello world program in document formats, etc. -[Unknown] 09:59, Dec 21, 2004 (UTC)
If in one week nobody complains, I'll move 'GUI', 'Document formats', and 'Page Description languages' examples to three new articles (and to fix the internal references of other articles that links to this one). But please, I'm not a native english speaker so, could someone help me choosing good names for the new articles? Thanks -- suruena 09:32, 2004 Dec 28 (UTC)
Hmm... well, I would suggest:
But, I'm not sure. -[Unknown] 21:09, Dec 28, 2004 (UTC)

The right place to this is wikisource:Hello_world, let's keep the article small, descriptive and elegant. --EliasTorres 01:28, 10 Feb 2005 (UTC)

I 'm sure you meant Hello world program using GUIs, Brackets? I think the splitting up is a good idea, but of course the remaining article is very huge anyway. Elias is perhaps on to something, but on the other hand it's nice to have the examples in WKP. Ah, decisions, decisions... The Tyranny of Choice! :( --Wernher 02:14, 10 Feb 2005 (UTC)
I know, it's good to have examples, maybe the C hello world example and maybe five more, but the HUGE list perhaps belongs to wikisource:Hello_world (or to a separated list). We can use {{Wikisourcepar|Hello_world}} resulting:
EliasTorres 08:41, 20 Feb 2005 (UTC)

Disagree, just because the wiki is giving a warning doesn't mean you have to split the page. —Ævar Arnfjörð Bjarmason 15:28, 17 July 2005 (UTC)

Newlines

Why do some examples use newlines (eg. Perl) while others do not? It seems to me that they should be consistent, and personally I would suggest no newlines... but some languages don't even allow that (well, I'm thinking of DOS batch files, but they hardly count anyway.) -[Unknown] 21:01, Sep 29, 2004 (UTC)

The hello world program is supposed to output a newline. Some languages have print statements that automagically add a newline and some don't. Perl doesn't. Python and Ruby do. Hopefully, the page is already consistent in this regard. --Yath 22:50, 29 Sep 2004 (UTC)
Okay, I updated some of the examples to do this, except where it didn't make sense or I wasn't sure about the language (eg. JavaScript *shouldn't* use a newline in popups.), and I also tried to fix a few places which were using "Hello, world" or similar because most of the examples used the standard "Hello, world!" (with exclamation mark.) -[Unknown] 21:01, Sep 30, 2004 (UTC)
Well, if you want to get involved in the standard form, they should all say "hello, world". This was the first known use, in http://cm.bell-labs.com/cm/cs/who/dmr/btut.html Mga 02:12, 24 May 2005 (UTC)

Other Languages

It occurs to me that this page can be translated into other languages extremely easily. Since programming languages do not change between England and Germany, for instance, we could get a German translation with the simple replacement of "Hello, World!" with "Hallo, Welt!". Is this already done or have I overlooked something? ~~----

Scroll to the bottom of the page when editing; you'll see that there are a great many languages featuring this article (or, that is, a translated version of it.) -[Unknown] 07:45, Oct 1, 2004 (UTC)

Translating the "Hello, World" concept into different languages

Hello. I think that these examples could be more useful and interesting if an attempt were made to translate the notion of "simplest interesting program in language X" rather than "simplest program to do console output in language X". Many of the languages listed are procedural languages which are not conceptually very different from C, so their "Hello, World" programs are not very different. However, Prolog, for example, is quite different from C, so its "Hello, World" program should show something about the concepts behind Prolog. Comments? Regards & happy editing, Wile E. Heresiarch 01:30, 6 Nov 2004 (UTC)

Unexplained part in ARM

For the RISC OS entry, somebody (anon) came up with a neat and more concise version of what I wrote, but there is this comment:

"or the even smaller version (from qUE);"

I have no idea what qUE is, does anybody happen to know, or should I remove the "from qUE" part?

Page too wide

The page is too wide. Maybe long lines should be splitted? It isn't much difference if you, for example, make line break between list of funcion parameters. --Derbeth 22:47, 16 Dec 2004 (UTC)

I moved the "too-long-one-liner" Malbolge example over to the esoteric languages article, where it belongs, and took the chance of splitting the "offending line" of the Ruby GUI example in two, marking the split with a backslash ("\"), which is common in some text editors, and in some compilers/languages. I reckon I'll be swiftly corrected if that makes it incorrect Ruby syntax :-) --(talk to) Wernher 01:42, 17 Dec 2004 (UTC)
According to a couple pages I found on Google, the slash is actually valid syntax. [2] [3] I don't actually know Ruby, though, so I can't confirm it. -[Unknown] 06:34, Dec 17, 2004 (UTC)
It's correct syntax. Ruby [vaporware] developer confirms. The best source? Type in the program and run it. ^_^ Paulymer5 22:56, 18 January 2006 (UTC)
I made some changes, now article has right width. --Derbeth 15:06, 17 Dec 2004 (UTC)
Eh -- interesting; I thought *I* did it, as of this edit? Whatever, main thing is its OK. :-) --Wernher 16:51, 17 Dec 2004 (UTC)

Too many BASICs!

IMHO there were far too many BASIC dialects listed in this article which used the same example. The vast majority of BASIC compilers and interpreters understand the following code:

   10 PRINT "Hello, world!"
   20 END

Yes, some dialects support minor variations on the above—Commodore BASIC allows one to substitute ? for PRINT, and many structured BASIC dialects make the line numbers optional. But there is no reason for showcasing all these little optional variations when the compiler/interpreter in question can process the elementary version above.

I have therefore removed all subsections on specific BASIC dialects which are capable of running the above example and added an explanatory note under the main BASIC heading. (I suspect that there may be more dialects which could also be collapsed, but I'm not familiar enough with them to test this hypothesis.)

In the future, I think it would be a good idea if people refrained from adding more BASIC dialects to the article unless they are incapable of processing the above example.

Likewise I recommend that similar procedures be followed for other programming languages on this page. We don't need to list all possible shortcuts and dialectical variations when the compiler/interpreter is capable of processing an ISO/ANSI/IEEE/ECMA/de facto standard version of the language. —Psychonaut 15:37, 2 Feb 2005 (UTC)

Not only Commodore BASIC, but every BASIC variant I've used allows ? for PRINT. Most of them are Microsoft BASIC variants, i.e. Commodore BASIC, GW-BASIC and AmigaBASIC, but AMOS on the Amiga also allows it, and it is not related with Microsoft. Maybe they got the idea from AmigaBASIC? 85.76.152.179 15:42, 16 Feb 2005 (UTC)
I'm pretty sure I was using ? for PRINT back in 1969 on a GE timesharing system. If not that far back, then in the mid-70s on whatever mini-computer we had at school (Data General, IIRC). Either way, long before the Amiga.
I agree, I used ? on Tandy (Tandy 1000 ?) BASIC in the 70's. (My first contact with a computer... I didn't know anything about computers and figured out by myself that if I prefixed expressions like 1+2 with '?', it showed the result. If not, nothing seemed to happen... ;-) MFH: Talk 20:20, 23 Jun 2005 (UTC)
I am the user 85.76.152.179 above. By "Maybe they got the idea from AmigaBASIC?" I meant AMOS. I was not implying AmigaBASIC invented the entire concept. I used ? for PRINT in Commodore BASIC years before I had even heard of the Amiga. JIP | Talk 28 June 2005 09:29 (UTC)

Java "OOP" version

Someone wrote a version in Java meant as an example of object-oriented programming. I'm not sure whether it was a meant as a parody of OO or Java, or as a well-intentioned contribution. I have removed this in any case because it was verbose. The point of Hello World is to be a simple test application. The more complicated you make your Hello World program the more you have to debug if it doesn't work, which defeats the purpose. Anyway the Java version as it stands is reasonably OO. System.out is an object that receives the message "println" with a string object as a parameter. You could instantiate Hello and do the work from the constructor, but you'd have to do that from the non-OO main method anyway. Ben Arnold 14:11, 19 Feb 2005 (UTC)

System.out is a class with a static method called println (the signature of which is public static void println(String arg), that is, it takes as the implicit parameter the name of the calss, and can only operate on its own internal data (varialbes, constants, adn literals),parameters, and the class's static fields (I beleive that tehr arenone in the System.out class). The java API documentation, avaliable with most java distributions lists this in more dtatil.

XML

Is there a valid reason that XML isn't featured, or should I add it? -- VJ 17:30, 22 Jun 2005 (UTC)

assembly needs not to be cryptic

I forgot most of what I knew about 65xx programming, but I think the given code does really make an effort on being as much cryptical as possible. I'd suggest at least the following:

putchar = $ffd2 ; system "chrOut" routine: send char to current output device
        LDX   #0
loop:   LDA   message,X   ; load character
        BEQ   return
        JSR   putchar     ; print it
        INX
        BNE   loop 
return: RTS
message: .ASC "Hello, world!"
         .BYTE 0

I don't remember the exact address, but I'm sure that there was also a routine for sending a null terminated string "at once". (What was $EA17 ?) MFH: Talk 17:45, 24 Jun 2005 (UTC)

Your version is 3 bytes longer, but yes, easier to understand. Mirror Vax 18:13, 24 Jun 2005 (UTC)
In the Commodore 16 at least, JSR $FF4F writes a null-terminated string that immediately follows the JSR; then returns to the instruction after the null byte. Another nicety is in the Canon X-07 where one of the single-byte RST instructions of the Z80-compatible processor vectors to the putchar routine.

<p> tag in HTML example

The information about the <p> in the simple HTML example was incorrect. The new block is simply stacked on top of the <h1> block (at least, it should be). Also, both tags are left open at the end of the document. Not really a problem, of course, but not formally correct. Even more, those whole header tags are unnecessary for the example.

I edited the example to close with the proper tag.

C: puts or printf?

It seems that at 22:08, 28 June 2005, an unknown user changed the C function used to write "Hello, world" from the classic "printf" to "puts", and also removed the "\n" (for \n, see the talk above).

I'm aware that puts is valid, and possibly even a better alternative than printf, which is designed to print formatted text, but I think of all the examples on the page, C is the one which should honor the original by using printf. This is reflected in the fact that every C example I have ever seen uses printf, including the original, and I quote from the article in question:

The book had inherited the program from a 1974 Bell Laboratories internal memorandum by Kernighan —Programming in C: A Tutorial— which shows the first known version of the program:
main( ) {
    printf("Hello, world!");
}

We've updated it to conform to the new ANSI standards but should not change printf. Therefore, I have changed it back to printf and added the "\n" back in. —EatMyShortz 6 July 2005 16:41 (UTC)

printf() for sure!
Atlant 6 July 2005 16:48 (UTC)
If the purpose of the "Hello World"-example is to present a minimal (and in this case ANSI C conforming) program that displays "Hello, World!" and a trailing newline, then
#include <stdio.h>

int main(void)
{
   puts("Hello, World!");
   return 0;
}
is the way to go. (Observe that `puts' adds a newline to the output.)
--Akarl 15:40, 20 July 2005 (UTC)

Microsoft Word example

While I find the MS-Word section hilarious, is this really germaine to this article? Isn't this something that belongs in an article about MS-Word, perhaps in a section that discusses ineffencies in its storage methods?

(But let me say again, it's hilarious)


MFC example

I miss an MFC example. Somthing like that:

AfxMessageBox("Hello, world!");

C variants?

Would it be salacious to include important C variants such as this example coded with the programming library for the Sega Saturn:

#include "sgl.h"

void ss_main(void)
{
   slPrint("Hello, world!", slLocate(9,2));
   slSynch();
}

There are important differences in these forms as compared to regular POSIX C. ThomasWinwood 15:44, 1 October 2005 (UTC)

Mathematica program misspelling?

I noticed that in the Mathematica example it says:

   Prant["Hello world!"]

[sic] I've never used Mathematica, but that doesn't quite look right to me. Is the print command really called "Prant"?

Cheating in GUI examples

GUI example of "Hello World" may be considered as a "skeleton"-like example of GUI program, but different kinds of message boxes, alarms et al. are not equal substitute. That's why such simplifications could be considered cheats. See e.g. full blown example of Windows API Hello World vs. its MessageBox() implementation.

It's pity that many examples provide only "cheat" implementation, like Python/Tkinter (tkMessageBox), VisualBasic (MsgBox), Cocoa/GNUStep/objC (NSRunAlertPanel)...

If it's hard to find more appropriate examples, I propose just to place all theese into separate section and have, for example, the next split:

  1. Text user interface (Known as TUI, console or line-oriented)
  2. Graphical user interfaces (GUIs)
  3. Primitive graphical user interfaces

-- Xrgtn 14:52, 25 October 2005 (UTC)

To distinguish "cheat" and "valid" GUI examples, I propose the next rule of extensibility: if it's easy to modify an example to add let's say a text field and/or a button, then the example is "good". For instance, the Tcl/Tk example:
 label .l -text "Hello, world!"
 pack .l
should be considered good, because you can easily add a button to the window:
 label .l -text "Hello, world!"
 button .b -text exit -command exit
 pack .l .b
-- Xrgtn 15:46, 25 October 2005 (UTC)


KML for Google Earth Section

Does the KML section really constitute a legitimate example of a Hello World program? --Dalziel 86 08:31, 1 November 2005 (UTC)

I think it doesn't. --tyomitch 08:59, 1 November 2005 (UTC)

The PBASIC example

From the PBASIC example: "or, the typical microcontroller Hello World program equivalent with the only output device present being a light-emitting diode (LED) (in this case attached to the seventh output pin)".

And it blinks forever in a regular pattern. Would it be so wrong to have it blink "HELLO WORLD" in Morse code? --Damian Yerrick 04:26, 6 December 2005 (UTC)

Not at all; a very nice "exercise for the student", actually. :) But not really required if we only want a simple test to see whether we have a minimum degree of functionality present in the controller, its connections, and the toolchain. --Wernher 06:28, 6 December 2005 (UTC)

Examples with empty lines

Some examples are shown in several boxes instead of one box. This happens when an example contains empty lines. Wikipedia interprets empty lines as end of the box.

I think the examples are easier to recognice and to read when each example is in one box (instead of several boxes). To reach this I added one space at the beginning of empty lines. I did this just for examples where it seems clear to me. Other spaces in empty lines should be added by someone else.

This article is ridiculously long

and has way too many subsectionsSavidan 12:27, 20 January 2006 (UTC)

References section

With hundreds of examples of programming languages on the page, why in the world are there exactly two references, both regarding PHP? It seems to me that any references should be general, about "Hello, World!", not regarding any one particular programming language. These belong at best on the PHP page.

bold edit

it seems that somebody did a really bold edit... I don't disagree that the former version of the article was not very nice to look at, but it should be at least possible to find the information which had been here before; at present, I cannot find any link to another WP page named *"hello world"* — MFH:Talk 05:21, 11 November 2006 (UTC)

So what happened to the list of "hello, world" programs? It looks like it may have been moved to another article, List of hello world programs, which was subsequently deleted. What gives? I agree that the main article should be short and sweet (and should only mention the original C program), but the list of programs in many other languages is useful, if for no other reason than it allows novice programmers to compare different programming languages. Can we re-instate the list article? — Loadmaster 17:40, 25 November 2006 (UTC)

Found out that the list has been trans-wikied to Wikibooks. That's probably a good thing. should there be a link to it in this article? — Loadmaster 00:36, 28 November 2006 (UTC)
Absolutely agreed. Mystifying that all that could have been removed without a reference being put in its place. I'd add it, but I dunno if it should be listed under 'See also' or 'External links' or other. 68.221.125.16 21:26, 11 December 2006 (UTC)
-- ah, I found it in the history - looks like it was linked to two different pages at one time so, in the interest of cleaning up, the link was removed... twice. I put the current one back. 68.221.125.16 21:32, 11 December 2006 (UTC)

AJAX

Do you want to know about this programming?

YES

Yes, I want to know this programming.

Hello world! What the heck do I need to make this thing work on my PC?

Hello Everyone!

I'd like to try this programme in C and totally confused about how this thing is set in to reality. I suppose these few lines are no to be written on the backside of a chocolate paper, but need a computer and program or environment, or call that whatever that can execute this. So how do I get this working, where is it going to print "Hello world!"?

I have Windows XP so don't have any preinstalled thing where I just would have to copy paste the text and click on "C'mon!".

Actually got interested by reading K&R2, nice book though it does not tell anything about where actually should one type those lines. It's like teaching swimming by telling how you have to move your arms and legs, but not telling that you have to go to the swimming pool, jump into the water and then doing the things with your legs and arms that has been taught. Brr... swimming in theory...

Thanks for any hints, if you understand my problem.

Geraldo —The preceding unsigned comment was added by 84.2.88.88 (talk) 21:23, 27 January 2007 (UTC).

I suppose K&R doesn't address the practicalities of compiling and running one's code because when it was written that could be a very site-dependent thing. That's why it's still relevent to you now, even though when it was written many of its readers would probably have been punching their code into cards to hand in to the mainframe operators.
To write your code you will need a text editor. Notepad will do, though you'd want to get your hands on something more capable for serious use. You will also need a compiler, which takes the text you write and turns it into a program that can run. I can't give you any first-hand advice here because I've never programmed on Windows (on Linux a C compiler is built-in, and on Mac OS X it's an option that can be enabled). A very quick google suggests that MinGW might be suitable for you, but don't take my word for it. I'm sure if you search for 'windows c compiler' you'll come across something.
You might also encounter something called an Integrated Development Environment or IDE. These combine an editor, compiler, and many other tools and are absolute lifesavers for people writing serious code. But they're also a lot more complicated than straightforward compilers and may overwhelm you to begin with. If you're still struggling to run Hello World I'd recommend sticking to the simpler way of doing things.
I hope this is helpful, and good luck in your explorations. If you have more questions it might be worth asking at the relevent Wikipedia reference desk PeteVerdon 01:07, 30 January 2007 (UTC)

The discussion above is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


removed link

Removed a link to "rawbw.com," as WOT has rated it untrustworthy, and "containing adult content" 68.183.36.159 (talk) 23:16, 17 March 2010 (UTC)

can we add at least a c++ code to the wiki?

i feel the article is very naked with a proper c++ code, consider it is the most stable and widely used programming languege there is today.

#include <iostream.h>
int main ()
{
   cout<<"Hello World.";
   return 0;
}

—The preceding unsigned comment was added by O1001010 (talkcontribs).

A wag might observe that we already have a perfectly-valid C++ program; it's the first one in the article ;-).
Atlant 16:44, 24 April 2007 (UTC)

that will compile? hummm.

By definition, any valid C program is a valid C++ program.
Atlant 23:48, 24 April 2007 (UTC)
No, that's not correct. C is not an exact subset of C++. The first (C) program in the article is not valid C++ code. In fact, it's not even valid C99 code. See Compatibility of C and C++ for more details.
As far as adding a C++ example, I think it is far more appropriate to provide only historically significant source code for the first few "Hello, world" programs, and let the List of hello world programs article provide all the rest.
Loadmaster 23:10, 8 May 2007 (UTC)



Let me point out that the "C++" code above is not ISO standards compliant. It should say <iostream>, not <iostream.h>. Most university computer science departments today teach Java as their introductory language, rather than C or C++, anyway. Also, according to the TIOBE Programming Community Index, Java has long been the most popular programming language, with C in second place and C++ in third. --JHP (talk) 05:17, 8 July 2011 (UTC)

Well, at least..

if not the most prevalent, how about [one of] the most esoteric? Brainf*ck!

+++++[>>>++++++<<<-]>>>++<<<++++++
++++[>++++++++++<-]>+++++++++<++++
+++[>>+++++++++++<<-]>>-----.+++++
<--------.+++++++..+++.>>>.<<<++++
++++.--------.+++.------.--------.

Marcthepirate 18:20, 8 May 2007 (UTC)

Again, see the List of hello world programs. Given the existence of that page it's probably more important to decide which specific examples to leave out of this one. —Preceding unsigned comment added by 202.27.216.35 (talk) 04:56, 9 December 2007 (UTC)

New tag for <source>code

I did not initially use this tag for the sample in B but someone has applied it pretending that the code is in C. If this is OK, then fine: otherwise could someone remove it? I'm not right now sufficiently clear that B is close enough to C for this to be valid. TIA HAND Phil | Talk 16:52, 15 May 2007 (UTC)

You're correct; C's syntax is not the same as B's, and that program demonstrates a couple of the differences. I've reverted the <source> tags to <code> anyway (per my comments at Wikipedia talk:WikiProject Programming languages, which you [Phil] already know about). <code> has the additional benefit of graceful degradation; I've tagged the B code with <code lang="b">, which would produce a nasty error message if you tried it with <source>. --Quuxplusone 06:59, 18 May 2007 (UTC)

Could we have a separate article on Hello world on different languages?

Could we have a separate article on Hello world on different languages to write hello world code in every language on earth?

I think that's more of a thing for wikibooks —Preceding unsigned comment added by 193.191.136.194 (talk) 13:21, 3 March 2011 (UTC)

should the LSL variation be mentioned?

in the virtual world Second Life when one creates a new script it is by default a variant of the hello world theme, instead of "hello world" it says "hello avatar". Should it be mentioned on this article?--TiagoTiago 21:57, 17 June 2007 (UTC)

Hello World BASIC

A BASIC program of Hello World is short, sweet, and shows one of the most simple if not the most simple Hello World Program.

Print "Hello World"

It is just as important as all of those other programming languages with the exception of C.

Super 4 Vegeta 22:30, 21 September 2007 (UTC)

Fortran 90

program prb implicit none


! here is the execution part

write(*,*) 'Hello World'


read(*,*) !this forces the pressing of a key before a window is closed

 end program prb  —Preceding unsigned comment added by 149.169.24.250 (talk) 18:28, 1 February 2008 (UTC) 

is the history acurate?

I was reading the instruction book for a trs-80 which ran on basic and i discovered that it also gave hello world as an example. if memory serves (this was a while ago) it said that the use of hello world had been part of a trdition started before BASIC! could someone find a way to check me on this and then if i'm right change the history. —Preceding unsigned comment added by 71.250.3.220 (talk) 21:24, 26 April 2008 (UTC)

Pre-history of the phrase

I wonder where the phrase actually comes from. Perhaps from some movie, animated cartoon, or TV show? (They would be fitting words for a newly hatched chick, for instance.) If so, it may have been something that Kerighan (or some earlier programmer) watched; meaning that it could be from anywhere between the 1930's and the 1960's. Jorge Stolfi (talk) 03:20, 30 June 2008 (UTC)

and in GOL:

This is the GOL code for hello world:

outputmessage~ Hello World

Check out http://www.roesler-ac.de/wolfram/hello.htm for a place to submit Hello World programs into a Collection. 92.192.120.33 (talk) 20:45, 20 January 2009 (UTC)

I reverted two of Andy Dingley's recent reversions

Two anons, one of them me and the other someone else, recently made constructive changes to this article that were reverted by User:Andy Dingley. I've reverted those changes. Because my changes (and the other anon's) were made in good faith, and I believe Andy's changes were also made in good faith, I'd like to explain why I've made the reversions. If disagreement remains we can discuss. I know there is an unfortunate tendency among some WP editors to feel like anon edits are not constructive and that reverting them doesn't require the same amount of thought or discussion. I hope that's not the case here. Anyway, moving on...

The "exposition on B" that Andy presumably added (which I then removed) is pasted below for clarity:

An exposition: the only fundamental data type in B is the machine word. On the Honeywell 6070, the machine that the particular version of B that was described ran on, this is 4 bytes long. The character constant correctly expresses this fact. There is no = in initializers in B.

I removed this blurb because it has nothing whatever to do with Hello World, the subject of this article, and instead serves only to explain how the B programming language works. In my original removal comment I noted that this material more properly belongs in article about B, and indeed, it is extensively treated there already. As we link to the B (programming language) article in the text, an interested reader can easily find a thorough treatment. Furthermore, I find the "An exposition:" clause to be stylistically inappropriate.

In general, the whole paragraph describes something that should be immediately obvious to any computer programmer (B is not so different from C that it isn't clear). For the non-programming audience, this article is already not particularly accessible, and Andy's paragraph is clearly not aimed at them anyway. "machine words", "bytes", "no = in initializers" wouldn't make sense to anyone who doesn't program already. It's basically just a detour. This article is not meant to introduce B to the masses.

Now, on to the other anon's change. He removed Lisp from the list of functional languages, because, well, Lisp is not a functional programming language. Not only do people from the staticly typed ML and Haskell worlds not consider Lisp to be a functional programming language, but Lispers themselves are constantly pointing out that Lisp is multi-paradigm. These days, when people say Lisp, they generally mean Common Lisp, which most certainly is not functional (the standard doesn't mandate TCO in implementations, programmers make pervasive use of imperative DSLs like LOOP, the fact that it's a lisp-2 makes first class manipulation of functions more cumbersome, etc).

If you want to keep a member of the Lisp-family in that list, then substitute Scheme for Lisp -- Scheme is a Lisp, but it is not understood to be the Lisp in the way that CL is.

This is important because Lisp is widely believed to be a functional language by programmers with no experience with either functional programming or Lisp. We should not propagate this misconception.

Thanks. 72.42.144.222 (talk) 17:23, 4 December 2008 (UTC)

First of all, thanks for splashing my name all over the edit history comments and even the section header, whilst you prefer to hide behind an anon IP. Aren't we supposed to be discussing the edits, not the editor? Remember too that WP:AGF works both ways. I'd also point out that I've barely edited this article and didn't contribute either of these sections. Please don't presume that I'm an author with WP:OWN when you could have checked the logs first. You expect to be treated as a special case of an anon IP that's not a vandal (they're about as rare as a Pacific Northwest tree octopus), but you won't extend a similar courtesy to others.
  • Firstly the B exposition. diff. Yes, it's ugly. So think of a better way to phrase it and edit it, rather than blindly deleting.
B isn't C, especially when it comes to declaring literal strings. Whilst the phrasing of this isn't wonderful, the listing is confusing without it. Part of the value of "Hello World" historically was that you often had to work past crazy hindering syntax like this to get anything to work and that's why such a trivial program (in function) remained valuable, as its effort of implementation was anything but. Demonstrating the sheer cussedness of any coding in those days (Coral 66 took me 3 days to get HW working) adds value to the article for a modern reader who would otherwise barely credit why we bothered, or seemed so pleased when it worked.
  • Secondly the removal of Lisp "a functional language". diff.
Clearly if you read the context of the article Lisp (as the best known suitable example) ought to be included here and "functional language" is where the problem lies. ML or Haskell might even vanish too. This isn't a discourse on whether Lisp is or isn't functional (that's uninteresting anyway, as it depends on your precision when defining "Functional"). Besides which, I thought you didn't like discourses on language details... The reason why Lisp, functional languages and Haskell get mentioned at all is because they're "recursion friendly" languages (to coin a neologism) where the popular HW is a factorial rather than a println(). That's all we care about in this context, not definitions of "functional".
I don't claim that this sentence is perfect. But deleting Lisp makes it worse. It removes the one vaguely well-recognised term of the four and leaves the reader floundering. People who have even heard of Haskell, or who are comfortable with the finer details of language taxonomy, are rarely going to be those needing to have Hello World explained to them. Andy Dingley (talk) 02:56, 5 December 2008 (UTC)

99 Bottles of Beer (http://www.99-bottles-of-beer.net/)

Should this be edited in for comparison to Hello World as a programming-language teaching tool?

KingAlanI (talk) 19:13, 26 December 2008 (UTC)

Capitalization Hello world vs Hello World

There is inconsistancy between the different versions of the subject of the article. Some are spelled with world capitalized and some not, for example. Is this difference meaningful and correct in some way or is it just inconsistancy? Is there an accepted capitalization scheme? If not is there a reason why in the generic we shouldn't just pick one and go with it (i.e. except when referring to actual specific outputs)?


Goodbye world.--24.29.234.89 (talk) 07:10, 2 March 2009 (UTC)

Grammatical inaccuracy

Few have noted the grammatical inaccuracy of the statement "Hello World". That it should, in fact, be "Hello, World" according to the vocative use of the comma. — Preceding unsigned comment added by Technome (talkcontribs) 15:30, 3 February 2011 (UTC)

History Incomplete

One should note that "Hello World" is a somewhat peculiar phrase to be used in a first program. Herein lies the fact that the article's history section doesn't go back very far and certainly not to the roots of the phrase. Where did it come from?

Indeed, in my computing classes back in the 1974, "Hello" alone was used; it was seen as an interesting personification of the computer -- making it talk back to you. This first program was usually augmented by adding one's own name to the end, e.g. "Hello Peter." My own later experience in teaching had my students doing the same thing, even in test examples for a book we published in the early 80's.

But going back prior to the 70's, "Hello World" was in common use by the amateur (Ham) radio community and had been since the advent of the first voice signals (as illustrated by Danny Gregory's book "Hello World: A Life in Ham Radio"). I haven't done the research to see if it was common before that among Morse users. If radio aficionados were the first, the probable reason is that, due to the wide range of radio signals, saying "Hello World" seemed appropriate. As well, and in that Thomas Edison is said to have coined common usage of "Hello" for telephones in 1877 (in contrast to A. G. Bell's suggestion of "Ahoy"), it may be unlikely that the two-word phrase appeared before that time.

205.143.140.239 (talk) 18:00, 13 January 2011 (UTC) Pete Sawyer

"Predates the World Wide Web" ?

I fail to understand why that phrase is there... It also predates the invention of graphene, the fall of the Berlin wall, the 1998 Soccer World Cup, and the 2004 olympics.

The fact that "World Wide Web" has the word "World" in it doesn't make it relevant for this article.

This article is about a very small program, originally written in B, famously published in C. Nothing to do with the web. — Preceding unsigned comment added by 190.245.100.11 (talk) 19:27, 13 October 2011 (UTC)

It was a bad change. It relates more to GUIs than the web, and some supposed (but broadly irrelevant) distinction between programs limited to stdio and those with richer UIs. Andy Dingley (talk) 13:08, 14 October 2011 (UTC)

History looks like it may be Original Research

The History section of this article does not reference any sources that study the history of "Hello World". I can't currently find any sources to support the claims made in this section, and the references provided are merely links to related materials. (such as the webpage for the programming language B and someone's blog post about a "Hello World" program they made) This is sort of worrisome as this section has existed for quite a while, and other websites seem to be referencing this. (1)(2)(3) Either the source supporting this assertion should be found, or the section removed altogether if a history cannot be found. 129.244.55.36 (talk) 23:31, 20 September 2012 (UTC)

What claims? B & C? These are very well attested. Ask your grandad. Andy Dingley (talk) 00:03, 21 September 2012 (UTC)
Sorry, speaking from another IP. For example, the line

The first known instance of the usage of the words "hello" and "world" together in computer literature occurred earlier, in Kernighan's 1972 Tutorial Introduction to the Language B,[1] with the following code:

references the book in question, but does not provide any sources that say this was one of the first books to do such. Additionally,

the tradition of using the phrase "Hello, world!" as a test message was influenced by an example program in the seminal book The C Programming Language.

is also unverified, and although it may make sense as the book is influential, a secondary source should verify such claims. I don't know what you mean by B & C being claims, if you mean the programming language like I think you do, but I did not mean to say that. If it were just to show that the programming language exists or to link to related materials, then those references would be fine; the problem is that they're being used as references to show the source of the "Hello, World" program, when these sources say nothing about being that source. (they also would be primary sources, and would fail the original research guidelines as per WP:PRIMARY) So far, I can't find any secondary sources (that don't reference this article) that would support that claim. 129.244.140.211 (talk) 04:48, 21 September 2012 (UTC)

Then find a source that shows an earlier claim and add it. Andy Dingley (talk) 08:47, 21 September 2012 (UTC)
The problem is I can't find anything to support the claims that I quoted, nor can I find anything that talks about the history of the "Hello World" program that isn't ripped from this article. 129.244.140.211 (talk) 14:59, 21 September 2012 (UTC)


Link to factorial?

I see lots of people implementing recursive factorial as their second program in a language they're learning. Maybe this page could link to factorial in the "see also" section?

Online Quiz

Can anyone explain what relevance this link (C Online Quiz) in the main page has to the subject?