[ 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 23 minutes ago:
1
2
3
4
int main () {
 printf("Hello world!");
 return 0;
}
view (4 lines, 1 line of output)
pasted 24 minutes ago:
1
2
3
4
int main () {
 printf("Hello world!");
 return 0;
}
view (4 lines, 1 line of output)


C++:
pasted 30 minutes ago:
1
2
3
4
5
6
7
#include <iostream>

int main()
{
    std::cout << "Hello, world" << std::endl;
    return 0;
}
view (7 lines, 1 line of output)
pasted 1 hour ago:
1
2
3
4
5
6
7
#include <iostream>
 
int main()
{
  std::cout << "Hello World!" << std::endl;
  return 0;
}
view (7 lines, 1 line of output)


D:
pasted on Aug 12:
1
2
3
4
5
6
import std.stdio;

void main()
{
    writef("Hello, world");
}
view (6 lines, 1 line of output)
pasted on Aug 7:
1
2
3
4
5
6
import std.stdio;

void main()
{
    writef("Hello, world");
}
view (7 lines, 1 line of output)


Haskell:
pasted on Aug 21:
1
main = putStrLn "Hello, World!"
view (1 line, 1 line of output)
pasted on Aug 18:
1
2
main :: IO ()
main = do putStrLn "Hello World"
view (2 lines, 1 line of output)


Lua:
pasted on Aug 20:
1
print("hello world")
view (1 line, 1 line of output)
pasted on Aug 19:
1
print("Hello World!");
view (1 line, 1 line of output)


OCaml:
pasted on Aug 8:
1
2
let x = "hello world";;
Printf.printf "%s" x;;
view (2 lines, 1 line of output)
pasted on Aug 8:
1
2
let x = "hello world";;
Printf.printf "%s" x;;
view (2 lines, 1 line of output)


PHP:
pasted yesterday:
1
2
3
<?php
print "Hello World!";
?>
view (3 lines, 1 line of output)
pasted yesterday:
1
2
3
<?php
  echo 'Hello, world!'; 
?>
view (3 lines, 1 line of output)


Perl:
pasted 2 hours ago:
1
print "Hello, World!\n";
view (1 line, 1 line of output)
pasted yesterday:
1
2
3
#!/usr/bin/perl

print "Hello World!\n";
view (3 lines, 1 line of output)


Python:
pasted 2 hours ago:
1
print ("Hello, World!")
view (1 line, 1 line of output)
pasted 2 hours ago:
1
print ("Hello, World!\n")
view (1 line, 2 lines of output)


Ruby:
pasted 14 hours ago:
1
puts 'Hello world'
view (1 line, 1 line of output)
pasted yesterday:
1
puts 'Hello, World'
view (1 line, 1 line of output)


Scheme:
pasted yesterday:
1
(display "Hello, world!")
view (1 line, 1 line of output)
pasted on Aug 19:
1
(display "Hello, World!")
view (1 line, 1 line of output)


Tcl:
pasted on Jul 31:
1
puts -nonewline "Hello world!"
view (1 line, 1 line of output)
pasted on Jul 16:
1
puts -nonewline "Hello world!"
view (1 line, 1 line of output)