[ 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 | Tcl ]

C:
pasted 3 hours ago:
1
2
3
4
5
6
#include <stdio.h>

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

int main(void) {
  printf("hello world\n");
  return 0;
}
view (6 lines, 1 line of output)


C++:
HeavyRain - pasted 4 hours ago:
1
2
3
4
5
6
int main()
{

   cout << "Hello World!";

}
view (6 lines, 1 line of output)
pasted 4 hours ago:
1
2
3
4
5
6
int main()
{

   cout << "Hello World!";

}
view (6 lines, 1 line of output)


D:
pasted yesterday:
1
2
3
4
5
import std.stdio;
int main () {
    writefln("Hello world!");
    return 0;
}
view (5 lines, 1 line of output)
pasted on Feb 4:
1
2
3
4
void main()
{
     writef("Hello World");
}
view (4 lines, 1 line of output)


Haskell:
pasted on Feb 6:
1
main = putStr "hello, world\n"
view (1 line, 1 line of output)
pasted on Feb 1:
1
main = putStrLn "Hello, World!"
view (1 line, 1 line of output)


Lua:
pasted on Feb 7:
1
print 'hello world!'
view (1 line, 1 line of output)
pasted on Feb 5:
1
io.write('Hello world');
view (1 line, 1 line of output)


OCaml:
pasted yesterday:
1
print_endline "Hello World";;
view (1 line, 1 line of output)
pasted on Feb 7:
1
print_string "Hello world!\n";;
view (1 line, 1 line of output)


PHP:
pasted yesterday:
1
2
3
<?php
echo 'hello world'
?>
view (3 lines, 1 line of output)
pasted on Feb 7:
1
2
3
4
<?
echo "hello world";

?>
view (4 lines, 1 line of output)


Perl:
pasted yesterday:
1
2
3
4
5
6
$s = "Hello world\0hello\0\0";

print $s,"\n";
$t = scalar(unpack("Z*", $s));

print length $t, $t;
view (6 lines, 2 lines of output)
pasted yesterday:
1
2
3
$s = "Hello world\0";

print scalar(unpack("Z*", $s));
view (3 lines, 1 line of output)


Python:
pasted yesterday:
1
print "Hello, world"
view (1 line, 1 line of output)
pasted yesterday:
1
print 'Hello, world'
view (1 line, 1 line of output)


Ruby:
pasted 5 hours ago:
1
puts 'hello world'
view (1 line, 1 line of output)
pasted on Feb 5:
1
print("Hello, World!")
view (1 line, 1 line of output)


Scheme:
pasted 4 hours ago:
1
(display "Hello World!")
view (1 line, 1 line of output)
pasted on Feb 6:
1
(display "Hello World!")
view (1 line, 1 line of output)


Tcl:
pasted on Dec 24:
1
puts -nonewline "Hello, world!"
view (1 line, 1 line of output)
pasted on Dec 24:
1
puts -nonewline "Hello, world!"
view (1 line, 1 line of output)