Hello world!
I am really excited to be writing my first blog post as part of setting up my online presence at bernardic.ca.
Since I work as a programmer, and have a Bachelors degree in Computer Scrience, I think it would be good to start with a hello world. Here it is in all the programming languages I use or have used. The constraint is of course that I don’t look it up on the Web or in other people’s source code, but rather either go by memory, or memory plus the help of a compiler/interpreter:
PHP
<?= 'Hello World!'?>
Ruby
puts 'Hello world!'
Python
print 'Hello world!n'
Java
public class Hello {
public static void main(String[] args){
System.out.println("Hello world!");
}
}
LISP
(print "Hello, World!")
Perl
print "Hello World!n"
C
#include <stdio.h>
int main() {
printf("Hello World!n");
}
bash
echo 'Hello World!'
Javascript
alert("Hello World!");
or
window.onload = function () { document.write("Hello World!"); }
C#
using System;
public class Hello {
public static void Main() {
Console.WriteLine("Hello World!");
}
}
There it is. I also tried C++, but could not figure out the whole stdout << “Hello World!”, or however it would actually go. 🙂 Happy Coding!
I suspect I could just about get OPL, Delphi, and a few others.
YOU MISSED HTML!
That’s the easiest:
HTML
Hello World!
OPL and Delphi? Wow, how did you come across those?
I thought about HTML, but decided against it since it is not really a programming language in the way they are most commonly defined.
I should have also done Spaghetti-code:
10 GOTO 30
20 PRINT ‘HELLO WORLD!’
30 GOTO 20
🙂