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-19-2011, 08:04 PM #2
Ameht!
Dark Knight
nice homie.
06-19-2011, 09:39 PM #3
Corrections

C++

    
#include <iostream>

int main()
{
std::cout<<"Hello World!";
return 0;
}


JavaScript
    
document.write("Hello World!");


Python
    
print("Hello World!");


:y:

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

Lowkey_, XxprokillahxX
06-19-2011, 09:51 PM #4
Saint Jimmy
And don't wear it out.
Originally posted by Relevant View Post
Corrections

C++

    
#include <iostream>

int main()
{
std::cout<<"Hello World!";
return 0;
}


JavaScript
    
document.write("Hello World!");


Python
    
print("Hello World!");


:y:


Clearly I was using Alerts/Messageboxes for languages that supported them, such as C++ and JavaScript, instead of just cout or document.write.

And you don't actually need parenthesis when using print in python Smile
06-19-2011, 10:55 PM #5
Originally posted by Saint
Clearly I was using Alerts/Messageboxes for languages that supported them, such as C++ and JavaScript, instead of just cout or document.write.

And you don't actually need parenthesis when using print in python Smile


'Kay, but the parenthesis used in python are supported in most version of python, so should be used as default, and the C++ MessageBox only works in WinAPI, and is actually not raw basic C++. :y: , the javascript however, is a valid alert. Smile
06-19-2011, 11:00 PM #6
Saint Jimmy
And don't wear it out.
Originally posted by Relevant View Post
'Kay, but the parenthesis used in python are supported in most version of python, so should be used as default, and the C++ MessageBox only works in WinAPI, and is actually not raw basic C++. :y: , the javascript however, is a valid alert. Smile


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
06-19-2011, 11:11 PM #7
Originally posted by Saint
Clearly I was using Alerts/Messageboxes for languages that supported them, such as C++ and JavaScript, instead of just cout or document.write.

And you don't actually need parenthesis when using print in python Smile

You should use parenthesis.. Its easier to read, and its a good habbit, for when you do c# and sh1t.
06-20-2011, 12:20 AM #8
schnzrs
Do a barrel roll!
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

Um, in the newest version of Python (3.2), you need parenthesis. Print is no longer a statement, it is now a function. Winky Winky
06-20-2011, 01:38 AM #9
Saint Jimmy
And don't wear it out.
Originally posted by schnzrs View Post
Um, in the newest version of Python (3.2), you need parenthesis. Print is no longer a statement, it is now a function. Winky Winky


print "Hello World!" works for me, just downloaded 3.2 from the website.

Anyways, don't even know why I'm arguing about this; C++ and Python scripts changed by popular demand Awesome face
06-20-2011, 04:21 AM #10
schnzrs
Do a barrel roll!
Originally posted by Saint
print "Hello World!" works for me, just downloaded 3.2 from the website.

Anyways, don't even know why I'm arguing about this; C++ and Python scripts changed by popular demand Awesome face

It's probably because 2.x is set as default.

This is what will happen in 3.2

>>> print "Hello World!"
File "<stdin>", line 1
print "Hello World!"
^
SyntaxError: invalid syntax

The following user thanked schnzrs for this useful post:

Relevant

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo