[ create a new paste ] login | about

Listed below are example programs that print "hello world", written in the following languages:
[ C | C++ | D | Haskell | Lua | OCaml | PHP | Perl | Python | Ruby | Scheme ]

C:
pasted 12 minutes ago:
1
2
3
4
5
int main()
{ 
    printf("hello world!\n");
    return 0;
}
view (5 lines, 1 line of output)
pasted 2 hours ago:
1
2
3
4
5
6
7
8
#include <stdio.h>

int main()
{
    printf("Hello World");

    return 0;
}
view (9 lines, 1 line of output)


C++:
pasted 5 hours ago:
1
2
3
4
5
6
7
8
#include <iostream>
using namespace std;

int main() 
{
    cout << "Hello, World!";
    return 0;
}
view (8 lines, 1 line of output)
pasted yesterday:
1
2
3
int main(){
cout<<"Hello World";
}
view (4 lines, 1 line of output)


D:
pasted on Dec 8:
1
2
3
4
5
6
import std.stdio;

void main()
{
    writefln("Hello, World!");
}
view (6 lines, 1 line of output)


Haskell:
pasted 2 hours ago:
1
main = putStrLn "Hello World"
view (1 line, 1 line of output)
pasted on Mar 26:
1
main = putStrLn "Hello, world!"
view (1 line, 1 line of output)


Lua:
pasted on Apr 19:
1
print("Hello world!")
view (1 line, 1 line of output)
pasted on Apr 18:
1
print("Hello, world!")
view (1 line, 1 line of output)


OCaml:
pasted on Mar 20:
1
2
3
4
5
6
let main _ = 
    Printf.printf "Hello World"


let () =
    main ()
view (6 lines, 1 line of output)
pasted on Mar 4:
1
print_endline "Hello World!"
view (1 line, 1 line of output)


PHP:
pasted on Apr 16:
1
2
3
<?php
  echo "Hello world";
?>
view (3 lines, 1 line of output)
pasted on Apr 15:
1
2
<?php
echo "Hello World";
view (2 lines, 1 line of output)


Perl:
pasted on Apr 17:
1
print "Hello, world!";
view (1 line, 1 line of output)
pasted on Apr 17:
1
print STDOUT "Hello, world!";
view (1 line, 1 line of output)


Python:
pasted yesterday:
1
print("hello world")
view (1 line, 1 line of output)
pasted on Apr 22:
1
print("HELLO WORLD")
view (1 line, 1 line of output)


Ruby:
pasted on Apr 20:
1
puts 'Hello world'
view (1 line, 1 line of output)
pasted on Apr 16:
1
puts "Hello World"
view (1 line, 1 line of output)


Scheme:
pasted on Apr 18:
1
(display "Hello World!\n")
view (1 line, 1 line of output)
pasted on Mar 11:
1
(display "Hello, World!")
view (1 line, 1 line of output)