[ 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 15 seconds ago:
1
2
3
4
5
6
#include <stdio.h>
int main()
{
   printf("Hello, World!");
   return 0;
}
view (6 lines, 1 line of output)
pasted 3 minutes ago:
1
2
3
4
5
6
#include <stdio.h>
int main()
{
   printf("Hello, World!");
   return 0;
}
view (6 lines, 1 line of output)


C++:
pasted 4 hours ago:
1
2
3
4
5
6
7
#include <stdio.h>
int main()
{
   // printf() displays the string inside quotation
   printf("Hello, World!");
   return 0;
}
view (7 lines, 1 line of output)
pasted yesterday:
1
2
3
4
5
6
7
8
9
#include <stdio.h>

int
main (void)
{
  printf ("Hello, World!\n");
  getchar ();
  return 0;
}
view (9 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 May 23:
1
main = putStrLn "hello world"
view (1 line, 1 line of output)
pasted on May 23:
1
main = putStrLn "hello, world"  
view (1 line, 1 line of output)


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


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


PHP:
pasted 1 hour ago:
1
2
3
4
<?php
echo "hello world!";

?>
view (4 lines, 1 line of output)
pasted on May 27:
1
hello world
view (1 line, 1 line of output)


Perl:
pasted on May 26:
1
print "hello world \n";
view (1 line, 1 line of output)
pasted on May 23:
1
print "hello world \n";
view (1 line, 1 line of output)


Python:
pasted 53 minutes ago:
1
print('hello world')
view (1 line, 1 line of output)
pasted 53 minutes ago:
1
print('hello world')
view (1 line, 1 line of output)


Ruby:
pasted on May 26:
1
puts "Hello World!";
view (1 line, 1 line of output)
pasted on May 25:
1
puts "Hello, World!"
view (1 line, 1 line of output)


Scheme:
pasted on Apr 29:
1
(display "Hello, world!")
view (1 line, 1 line of output, 99 comments)
pasted on Apr 11:
1
(display "Hello World")
view (1 line, 1 line of output, 99 comments)