How many (programming) languages do you know?
This is a contest. The point is to make a "Hello, world" statement--a programming statement to print "Hello, world" to the screen--in as many programming languages as possible. The full program is not required, only the print-to-screen statement. Please don't look any up on the Web; it's supposed to be from your own prior knowledge. After I verify that it's correct, the first place winner gets to send me 5 tokens worth of stuff; 2nd, 3, and 3rd place, 1. Post your entry here, with the language it comes from and the Print statement itself.



supertux on Nov 20, 2007
cout << "Hello World" << endl;
supertux on Nov 20, 2007
Thats C++ btw
supertux on Nov 20, 2007
You know, shouldn't we whisper these to your box? That way people can't copy and more than one person can be credited for knowing the same language...
Granf on Nov 20, 2007
display dialog "Hello, world"
printf ("Hello, world");
system.out.println ("Hello, world")
system.out.println ("Hello, world");
10 print "Hello, world"
Hello, world
cout << "Hello, world" << endln;
print hello,
print world
graphicstype "Hello, world
string("Hello, world")==>Image with String()==>Billboard
Hello, world
LANGUAGES:: AppleScript, C, JavaScript, Java, Basica, Clarion, C++, Unix, Logo, Quartz, HTML
supertux on Nov 20, 2007
I give up.
elnitido52 on Nov 20, 2007
Basic, Turbo Basic, Visual Basic, FORTRAN, RPGII, UNIX, DOS, QuickBasic, JavaScript, HTML, COBOL and learning some others at the moment...as you can see...many Old School...
rajr19 on Nov 20, 2007
puts "Hello World"
ruby :P
Granf on Nov 20, 2007
COBOL:: Completely Outdated Business Operating Language.
Granf on Nov 20, 2007
You used 4 different forms of basic!
Granf on Nov 20, 2007
sorry, forgot DOS
echo hello,
echo world
Granf on Nov 20, 2007
and assembly:
501, %48
502, %65
503, %6c
504, %6c
505, %6f
506, %2c
507, %20
508, %77
509, %6f
510, %72
511, %6c
513, %64
514, %a
515, %a
Granf on Nov 20, 2007
puts me at 13
Granf on Nov 20, 2007
Maybe we should have a "compiled" language contest, a "formatting" language contest, and a "scripting" language contest.
Dave on Nov 20, 2007
1) Brainfuck: (no joke. Although I admit I didn't write this line, it's from wikipedia)
++++++++++[>+++++++>++++++++++>+++>+<<<<->++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
"Whitespace" is another good one for confusing people with. Google it if you haven't heard of it.
2) jamascript (a non-standard one. The main compiler for it is no longer sold which is a shame since it's a very neat language)
CurWindow.writeln( 'Hello, World' );
or as I prefer
oWin.drawText( 'Hello, World', 5, 5 );
3) javascript
writeln( 'Hello, World' );
although I never use that any more.
myDiv.insertAdjacentHTML( "beforeEnd", "<p>Hello, World</p>" )
is more useful, but you need a load of code to make it work in firefox that I couldn't write off the top of my head.
4) java
System.out.writeln( 'Hello, World' );
5) HTML :P
<p>Hello, World</p>
or
<img src="helloWorld.png" alt="Hello, World" />
6) PHP
print "Hello, World";
or
?>Hello, World<?php
7) C++
cout << "Hello, World";
8) Actionscript
trace "Hello, World"
or to make it visible to the user:
myTextInstance.text = "Hello, World";
9) Windows Batch File (lots of people don't see the use of this one but I've used it a fair bit to automate simple file actions)
@ECHO Hello, World
(or even just REM Hello, World if ECHO OFF hasn't been used. Though that puts a REM in front of it)
And I used to know ASP, CGI and Visual Basic. Can I count them even if I can't remember them? :P
alethiophile on Nov 20, 2007
Is System.out.writeln useable? I thought it was System.out.println.
alethiophile on Nov 20, 2007
@granf: I don't think Quartz counts. Or does it? No, it doesn't, cause it's not a text-based language.
Teej
on Nov 20, 2007
People have already done all the ones I know already, so here's a new one:
ruby -
puts "Hello World"
sloan on Nov 20, 2007
.5 of HTML
.3 of CSS
alethiophile on Nov 20, 2007
?
Granf on Nov 20, 2007
quartz counts as much as anything. Don't be interfacialy exclusionary.
Granf on Nov 20, 2007
My favorite windows batch file for school:
copy con: c:\halo.bat
shutdown -s -t 15 -c "Ha! you honestly though that you were going to play halo at school!"
^Z
alethiophile on Nov 20, 2007
very funny, and if you have to do a crude text impersonation of the look of the program, it DOESN"T COUNT. Also, I like:
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
system("shutdown -s -t 15 -c \"Ha! you honestly though that you were going to play halo at school!\"");
return 0;
}
alethiophile on Nov 20, 2007
That way, it's an EXE.
Granf on Nov 20, 2007
or just:
tell finder
display dialog "Ha! You honestly..."
end tell
wait 15000
shutdown
soprano on Nov 20, 2007
I know fewer languages than Granf, I think.
I'm surprised no one did Python or Lua yet though.
Granf on Nov 20, 2007
C#?!??!?!?!? t3h 3vil!
alethiophile on Nov 20, 2007
i don't think you can make applescript into a windows exe
Dave on Nov 21, 2007
"Is System.out.writeln useable? I thought it was System.out.println."
ah, could easily be. I always get mixed up with those and generally just change it if I get compile errors, lol
"i don't think you can make applescript into a windows exe"
does that matter? no one said these programs had to run on windows...
"I'm surprised no one did Python or Lua yet though."
From what I know of Python and Lua, they don't actually have a fixed way of writing a message, since they're designed to plug in to larger programs which will define their own functions. So each implementation of it will have different ways of saying "Hello, World"
and finally; I've always hated the Hello, World idea. Writing a static text to the screen is ridiculously basic, pretty much never used when making a real program (appart from maybe debugging but even then I'd prefer to write to a file) and doesn't really show any knowledge of a language. I could get assembly to say Hello, World but there's no way I could make it do more complicated things like sorting a list of numbers (or at least, I couldn't do it in a very optimized way) which I could easily do in most other languages. Just my 2 pence (I'm English so don't have any cents)
poscogrubb on Nov 21, 2007
bash and other shell scripting languages:
echo Hello,\ world!
AppleGeek
on Nov 21, 2007
AppleScript:
display dialog "Hello, world!"
BASIC:
msgbox ("Hello, world!");
Cocoa:
NSLog (@"Hello, world!");
[myTextField setStringValue:@"Hello, world!"];
[[NSAlert alertWithMessageText:@"Notice" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"Hello, world!"] runModal];
PHP:
print "Hello, world!";
echo "Hello, world!";
--
Hurray!
cartuning on Nov 21, 2007
Natural from Software AG
alethiophile on Nov 21, 2007
@dave: The Hello, world idea is not so much to show expertise in the program, but to A) make the student familiar with the text required to make a program work, such as the #includes in C++ or class definition in Java; B) to find out how to write, save, compile and run your programs on your platform; and C) to make the student familiar with the basic interface for their programs on their platform (do you type a command into the command line to compile/run? is there a built-in compiler in an IDE?).
Grusella on Nov 21, 2007
C#: console.Print("Hello world");
QBasic / GWBasic: ? "Hello word"
PHP:echo "Hello, world!";
Ruby: puts "Hello World"
DOS Batch file: echo Hello World
Java: System.out.println("Hello World!");
Perl: print "Hello World\n";
And so On: Assembly, pascal, delphy, etc.
katylava
on Nov 21, 2007
how about:
VISIBLE "HAI WORLD!"
:P
alethiophile on Nov 21, 2007
?
poscogrubb on Nov 21, 2007
@alethiophile: since making the student familiar with writing a working program is the purpose of "Hello, world", why does this post only ask for the single line that outputs? We should show the entire correct program... so you can see what kind of overhead each language imposes...
Baldwin on Nov 21, 2007
Still no python ?!
print "Hello, world"
VBScript MsgBox("Hello, world")
Visual Basic - See VBScript
The rest I know have already been done.
MrDee on Nov 21, 2007
VB.net
MessageBox.Show("Helo World", "This space for hire", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
iconmaniac on Nov 21, 2007
<X3D>
<Scene>
<Transform DEF='TRANSFORM'>
<Shape>
<Text string='Hello, world!'>
<FontStyle justify='MIDDLE'/>
</Text>
</Shape>
</Transform>
<TimeSensor DEF='TIMESENSOR' cycleInterval='4' loop='TRUE'/>
<OrientationInterpolator DEF='ORIENTATIONINTERPOLATOR' key='0 0.5 1' keyValue='0 1 0 0 0 1 0 3.14 0 1 0 6.28'/>
<ROUTE fromNode='TIMESENSOR' fromField='fraction_changed' toNode='ORIENTATIONINTERPOLATOR' toField='set_fraction'/>
<ROUTE fromNode='ORIENTATIONINTERPOLATOR' fromField='value_changed' toNode='TRANSFORM' toField='rotation'/>
</Scene>
</X3D>
Riverdog on Nov 21, 2007
Fortran 77, the first programming language I learned.
C Hello World in Fortran 77
PROGRAM HELLO
PRINT*, 'Hello World!'
END
PHP
<?php
// Hello World in PHP
echo 'Hello World!';
?>
Perl
# Hello world in perl
print "Hello World!\n";
Java
// Hello World in Java
class HelloWorld {
static public void main( String args[] ) {
System.out.println( "Hello World!" );
}
}
Java-Servlet
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
//
// Hello World Java Servlet
//
public class HelloWorld extends HttpServlet {
public void service(HttpServletRequest request,
HttpServletResponse response)
throws IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><body>");
out.println("Hello World!");
out.println("</body></html>");
}
}
Java-Server-Pages
<!-- Hello World for Java Server Pages -->
<%@ page language='java' %>
<%="Hello World!" %>
SQL
# Hello World in SQL
SELECT 'Hello World';
VBA
' Hello World in Visual Basic for Applications
Function HW()
HW = "Hello, World!"
End Function
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="HelloWorld.xsl" ?>
<!-- Hello World in XML -->
<text><string>Hello, World</string></text>
XSLT
<?xml version="1.0" encoding="UTF-8"?>
<!-- Hello World in XSLT -->
<xsl:stylesheet>
<xsl:template>
<xsl:text>Hello World!</xsl:text>
</xsl:template>
</xsl:stylesheet>
XHTML
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- Hello World in XHTML -->
<html>
<head>
<title>
Hello World!
</title>
</head>
<body>
<p>
Hello World!
</p>
</body>
</html>
CSS
/* Hello World in CSS */
body:before {
content: "Hello World";
}
ActionScript-Flash8
// Hello World in ActionScript 2.0 (Flash 8)
class HelloWorld
{
private var helloWorldField:TextField;
public function HelloWorld( mc:MovieClip )
{
mc.helloWorldField = mc.createTextField("helloWorldField", mc.getNextHighestDepth(), 0, 0, 100, 100);
mc.helloWorldField.autoSize = "left";
mc.helloWorldField.html = true;
mc.helloWorldField.htmlText = '<font>Hello World!</font>';
}
}
// on a frame
import HelloWorld;
var hw:HelloWorld = new HelloWorld( this );
ASP-JavaScript
Hello World for Microsoft ASP (in JavaScript)
<%@ language="javascript" %>
<html><body>
<%
Response.Write('Hello World!');
%>
</body></html>
GoogleGadgets
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Hello World as a Google gadget -->
<module>
<moduleprefs title="hello world example" />
<content>
<![CDATA[
Hello, world!
]>
</content>
</module>
Ruby
# Hello World in Ruby
puts "Hello World!"
Regular-Expression
Hello World as a regular expression.
Replaces everything with "Hello World".
For use with vi, sed, etc.
Search String : ^.*$
Replace String: 'Hello World'
Python
# Hello World in Python
print "Hello World"
Postscript
% Hello World in Postscript
%!PS
/Palatino-Roman findfont
100 scalefont
setfont
100 100 moveto
(Hello World!) show
showpage
alethiophile on Nov 21, 2007
*gasps*
I think he wins.
alethiophile on Nov 22, 2007
Unless someone else gives me more.
iconmaniac on Nov 22, 2007
Here are some of the languages/environments I can remember dealing with. Admittedly, I had to look up the syntax for a few of them.
Reasonably modern:
C++: cout << "Hello, world!" << endl;
C: printf("Hello, world!\n");
Java: System.out.println("Hello, world!");
PHP: echo 'Hello, world!';
Perl: print "Hello World!\n";
Python: print "Hello, world!"
javascript/DOM: alert('Hello, world!');
Win32/C: MessageBox(hwnd, "Hello, world!", "Hello, world!", MB_OK);
Unix shell: echo 'Hello, world!'
DOS batch: ECHO Hello, world!
Dynosours:
Pascal: WriteLn('Hello, world!');
Ada: Text_IO.Put_Line("Hello, world!");
Fortran: P R I N T *, 'Hello, world!'
PL1: put skip list('Hello, world!');
Turing: put "Hello World!"
Obscure:
Lisp: (print "Hello, world!")
Prolog: display('Hello World!')
Maple: printf("Hello, world!");
For quality over quantity my vote goes to the X3D code in my earlier post. If you want to see what it does, download Flux Player here, save the X3D code to a file with a .x3d extension and point your borwser at it.
Serenity on Nov 24, 2007
wow. is all i have to say, besides, Get A Life People! ;)
debragail
on Nov 24, 2007
Basic, C, Lisp, Prolog, ADA, Smalltalk, Pascal, Fortran, Python, DOS Batch, PHP, Unix shell (tcsh), Javascript, VB/VBA, Occam
debragail
on Nov 24, 2007
Oh, Serenity where can I download a life, can you give me the URL? xD
Granf on Nov 24, 2007
Isn't a "life" like a firmware update or something?
Serenity on Nov 26, 2007
hahaha very funny, but i already knew that one
"A Life?! cool where can i downlaod one of those!"
AndreaD on Nov 26, 2007
hmmm... Am I the only one who read this part from the OP?
"the first place winner GETS TO SEND ME 5 tokens worth of stuff; 2nd, 3, and 3rd place, 1."
So... you are all competing for the opportunity to send Alethiophile icon packages... not the other way around.
bkendall on Nov 26, 2007
@Andrea it is for the points and getting to use some stamps...
Steax on Nov 26, 2007
"A Life?! cool where can i downlaod one of those!"
Find one of the green mushrooms. 1 UP!
AndreaD on Nov 26, 2007
oic
oong on Nov 27, 2007
I refuse to waste so much time counting.
shrishaster on Nov 27, 2007
c++ , java n perl all basic stuff
alethiophile on Dec 07, 2007
The official contest is now off, since I already accepted some icons I actually wanted. Please, keep posting Hello World statements in obscure programming languages--it's entertaining and fun. :-)
Granf on Dec 07, 2007
wow. how mean of you. i would have won :(
alethiophile on Dec 07, 2007
Too hard to judge, as well.