Post: The "Hello World!" Collection
06-19-2011, 07:55 PM #1
Saint Jimmy
And don't wear it out.
(adsbygoogle = window.adsbygoogle || []).push({}); What's the first thing you do when you're working with a new programming language?
You say Hello, of course Smile

Here's a quick look at how different programming languages handle that simple task.

Visual Basic:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MsgBox("Hello World!")
End Sub


C#:
    public class Hello1
{
public static void Main()
{
MessageBox.Show("Hello World!");
}
}


C++:
    #include <iostream>
using namespace std;
int main ()
{
std::cout<<"Hello World!";
return 0;
}


HTML
    <html>
<body>
Hello World!
</body>
</html>


JavaScript
    alert("Hello World!");


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


PHP
    class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}


Pascal
    program HelloWorld(output);
begin
WriteLn('Hello World!'Winky Winky;
end.


Python
    print("Hello World")


Ruby
    puts "Hello World!"


Perl
    print "Hello World!\n";


If you can think of any other good programming languages to include, just say so. Winky Winky
(adsbygoogle = window.adsbygoogle || []).push({});

The following 2 users say thank you to Saint Jimmy for this useful post:

kiwimoosical

The following user groaned Saint Jimmy for this awful post:

40Thieves
06-20-2011, 08:39 AM #11
kiwimoosical
Bounty hunter
Where is the C++ 0x one yet :O ???
Jkzzz :P
06-20-2011, 08:54 AM #12
K-Snody
Loading... ████████] 99%
Dont get this ??????

The following user groaned K-Snody for this awful post:

06-20-2011, 09:08 PM #13
Originally posted by Saint
Well the latest official version of python doesn't requite the parenthesis, and since the people using "Hello World!" are probably new to the language, they're probably using that newest version.

Although I see that you're defiantly right about C++, I'll have to change that in a little bit Smile



C++ One does not require the name space std when calling cout directly using std:: Awesome face
07-09-2011, 03:34 AM #14
Here's java in case you would like to add it...
    System.out.println("Hello World");
07-09-2011, 10:18 PM #15
vSaBoTeuR x
< ^ > < ^ >
Originally posted by Saint
C++:
    #include <iostream>
using namespace std;
int main ()
{
std::cout<<"Hello World!";
return 0;
}


Why are you using the namespace std and still using an unary scope resolution operator to retrieve the cout-command from the library?

Here's a fixed version:
    #include <iostream>
using namespace std;

int main()
{
cout << "Hello World!" << endl;

return 0;
}


And here you have my sexy 16-bit ASM variant:
    ; Hello World!
; Microsoft Assembly Syntax
; To assemble, use DEBUG.EXE.
; Assemble at 0100h.

; Written by xNCK.

; Register DX will be filled with the hex value of its ASCII value (x = 120 = 0x7Cool Man (aka Tustin)
; int 21h will output register DX to the screen.
; int 20h will terminate the program.

mov ah, 02
mov dx, 0048
int 21
mov dx, 65
int 21
mov dx, 6C
int 21
mov dx, 6C
int 21
mov dx, 6F
int 21
mov dx, 20
int 21
mov dx, 57
int 21
mov dx, 6F
int 21
mov dx, 72
int 21
mov dx, 6C
int 21
mov dx, 64
int 21
mov dx, 21
int 21
int 20
08-05-2011, 12:37 AM #16
Here Is One For Batch
    @echo off
pause >nul
cls
Echo Hello World!
pause >nul

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo