[ 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 1 hour ago:
1
2
3
4
5
int main(void)
{
   printf("hello world!");
   return 0;
}
view (6 lines, 1 line of output)
pasted 1 hour ago:
1
2
3
4
5
int main(void)
{
   printf("hello world!");
   return 0;
}
view (6 lines, 1 line of output)


C++:
pasted 2 hours ago:
1
2
3
4
5
6
7
8
9
10
#include <iostream>

using namespace std;

int main()
{
   cout << "Hello World" << endl; 
   
   return 0;
}
view (10 lines, 1 line of output)
pasted 2 hours 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 Jan 10:
1
2
3
4
5
int main()
{
printf("hello world!");
return 0;
}
view (5 lines, 1 line of output, 99 comments)


Haskell:
pasted on Jun 25:
1
2
main :: IO ()
main = putStrLn "Hello World"
view (2 lines, 1 line of output)
pasted on Jun 7:
1
main = putStrLn "Hello, World!"
view (1 line, 1 line of output)


Lua:
pasted yesterday:
1
print("hello World")
view (1 line, 1 line of output)
pasted on Jun 26:
1
print("Hello World")
view (1 line, 1 line of output)


OCaml:
pasted on Jun 18:
1
print_endline "Hello, world!"
view (1 line, 1 line of output)
pasted on Mar 5:
1
Printf.printf "Hello world!";;
view (1 line, 1 line of output, 99 comments)


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


Perl:
pasted on Jun 22:
1
2
my $hi = "Hello, world!";
print $hi."\n";
view (2 lines, 1 line of output)
pasted on Jun 21:
1
2
3
4
5
6
7
my $args = {
  a => "ab",
  b => "ba"
};

print "Hello World\n\n";
print $args{b};
view (7 lines, 2 lines of output)


Python:
pasted 14 minutes ago:
1
print "hello world"
view (1 line, 1 line of output)
pasted 1 hour ago:
1
print("hello world")
view (1 line, 1 line of output)


Ruby:
pasted 2 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 on Jun 24:
1
(display "Hello, World\n")
view (1 line, 1 line of output)
pasted on Jun 22:
1
(display "Hello World!")
view (1 line, 1 line of output)