Subscribe to Jack of all Languages        RSS Feed
***** 1 Votes

Hello in Ten Languages

Icon 11 Comments
I woke up surrounded by the debris of the night before. I pushed past the empty coke cans and brought my laptop out of hibernation. As the hard drive spun into action, the screen flicked on revealing a desktop littered with used language installers.

Welcome to day two of my project. I have set out to learn ten programming languages and the first step was to get them up and running and write "Hello World!" In each.

None of the languages presented any real problems. I already had Ruby installed. A quick puts "Hello World!" and I'm done.

Python was up next. I went for 3.2.2, thinking I might as well learn for the future, even if it's not the industry standard yet. The windows installer did everything except set the path variable. Hardly a biggie but in a language that's supposed to be so easy and intuitive, it seems like a silly hurdle to present a newbie. Erlang was the only other language that needed this set. print("Hello World!") was simple enough, and probably my favourite "Hello World".

Haskell's installation was straightforward as was main = putStrLn "Hello World!", though I'm sure there's a monad in there somewhere.

Erlang was straightforward too but I will have trouble finding the recommended browser for viewing their documentation: Netscape.


hello_world() -> io:fwrite("Hello world!\n").

GCC was already installed so all I had to do was write and run my first C program.
#include <stdio.h>

int main() {
	printf("Hello World, from c!\n");
	return 0;

There is no shortage of tutorials showing me various ways to write that and tell me what all the lines do. But most of them don't mention that I should save it in a .c file, nor do they guide me through using the compiler. I found a good tutorial before long and all was right with the world.

C# came with visual studio. After a lengthy installation, it took me about 5 seconds to throw a program together. I bet I don't need the imports it auto generated for me but, hey:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Hello_World
    class Program
        static void Main(string[] args)
            Console.WriteLine("Hello World!");

Javascript was simple. Just saved a quick file and dragged it into my browser:

		<script type="text/javascript">
			alert("Hello World!");

BASH on Windows? Actually, there are lots of options including Cygwin, SSH to a university linux computer or turning on the linux netbook that was right next to me. What I did though was use GIT BASH which was only a right click away. It worked fine for this:

echo "Hello World! from BASH"

For Smalltalk I went with Squeak. I've never used an environment like it before but it looks fun to use. Transcript show: 'hello world' did the job.

I was persuaded to add Lua to my list of languages. It is intended as an embeddable scripting language so most of the releases are source code. That doesn't interest me right now so I found luaforwindows which is an all-in-one solution. The installer gave me the option of watching a quick language demo and ~35 very quick slides later, I felt I could already write some code. I'm very impressed with this and would like to see more languages follow suite. print("Hello World!")

So, there we go. Ten languages all set up and ready to go. Next, I have to find some tutorial questions to work though...

11 Comments On This Entry

Page 1 of 1

Dogstopper Icon

13 October 2011 - 07:01 AM
Very good!

Maybe Martyr2's list can help you come up with some good ideas.

Gamegoofs2 Icon

13 October 2011 - 07:05 AM
I like it! Very well written blog too.

Curtis Rutland Icon

13 October 2011 - 08:47 AM
You are right about C#, you don't need all the "imports" (they're called "using directives", btw) for a basic program. Here's the absolute bare minimum C# hello world program:

public class Program {
    public static void Main() { System.Console.WriteLine("Hello World"); }

No usings, no namespace, no Main parameters. Very stripped down. Next you should try Hello World in WPF or ASP.NET MVC 3. Not much harder, Visual Studio does all the designer work for you.

As for Javascript, learn to love the console object. I've tried the whole alert debugging, and it's a nightmare. Once I learned there's a console I can log objects directly to, it made things a lot easier.

cfoley Icon

13 October 2011 - 09:53 AM
Thanks for the positive feedback guys. :)

Dogstopper, I was thinking of using that later on. There is a list from Psycho Coder too, but for now I think simple beginner exercises are more appropriate, at least until I get comfortable with the syntaxes and idioms. I'm hoping to get inspiration from the help forums too. I often find people asking help with interesting things that I go away and code myself anyway. Now, I can go away and code it 10 times in 10 different languages!

Thanks for the feedback Curtis. That's one of the reasons I'm blogging about this so feedback is very welcome. :) Is it the done thing to use the fully-qualified name in C#. In Java you would only ever do that if you have a name clash.

I'll be sure to do an MVC 3 Hello World too, and thanks for the tip about the JS Console. I'll rework that snippet later tonight.

Curtis Rutland Icon

13 October 2011 - 10:58 AM


Is it the done thing to use the fully-qualified name in C#. In Java you would only ever do that if you have a name clash.

Not usually. More often, you'd add the using directive. I was just showing the smallest possible hello world application.

Actually, you don't even have to use a fully qualified name even if there is a naming conflict. We have what's called aliases. Let's say we have two classes CurtisRutland.Com.Person and CFoley.Com.Person.

There's multiple ways we can handle this. For instance, if we want both to be available, we can alias one:

using CurtisRutland.Com;
using CF = CFoley.Com;
var crPerson = new Person();
var cfPerson = new CF.Person();

Or, if we wanted to include both namespaces (say, for the other types they include), but we wanted to specify which one Person should be referred to:

using CurtisRutland.Com;
using CFoley.Com;
using Person = CFoley.Com.Person;
var person = new Person();//is a CFoley.Com.Person

So you almost never have to use a fully qualified name. Sometimes it helps organization, but aliases are even better for that.

master.bennett Icon

13 October 2011 - 12:34 PM
As promised I have decided to join but due to an awkward schedule, Im planning to stick with Python only.

I went slightly further in the traditional Hello World with:

print("Hello ! What is your name")
name = input("Enter your name")
print("You may pass, " + name)

master.bennett Icon

13 October 2011 - 12:35 PM
btw, I could not edit my post but just to note, concatenation in Python 3.2 can be done this way too:

print("You may pass, ", name)

Using a "," before the variable

ishkabible Icon

13 October 2011 - 01:33 PM
sweet! i infected someone else! i hope you enjoy Lua as much as i do :)

cfoley Icon

13 October 2011 - 03:46 PM
No problem. I'm sure I'll be modding games in no time. ;)

Thanks for the info there, Curtis. I don't believe there is an equivalent for Aliasing in Java.

master bennet, glad to have a companion!

fromTheSprawl Icon

13 October 2011 - 07:55 PM
Oh, you started already. I guess I'll just follow what path you'll take. Nice start for th journey! ^^

poncho4all Icon

14 October 2011 - 11:48 AM
I'm up to date, i'll be following your lead but only in python, ruby, lua, haskell and bash.

I'm waiting on for the next step, I'm guessing it should be something with imputs and variable use.

statinding by..
Page 1 of 1

Trackbacks for this entry [ Trackback URL ]

There are no Trackbacks for this entry

April 2017

2324252627 28 29


    Recent Entries

    Recent Comments

    Search My Blog

    0 user(s) viewing

    0 Guests
    0 member(s)
    0 anonymous member(s)