[ create a new paste ] login | about

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

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

printf("Hello world");
}
view (5 lines, 1 line of output)


C++:
pasted 5 hours ago:
1
2
#include <stdio.h>
int main(){printf("Hello World!");}
view (2 lines, 1 line of output)
pasted yesterday:
1
2
3
4
5
6
7
#include <stdio.h>

int main()
{
printf("HELLO WORLD\n");
return 0;
}
view (7 lines, 1 line of output)


Haskell:
pasted on Oct 16:
1
main = putStrLn "Hello, world!"
view (1 line, 1 line of output)
pasted on Oct 16:
1
main = putStrLn "Hello, world!"
view (1 line, 1 line of output)


Lua:
pasted on Oct 8:
1
print("Hello World")
view (1 line, 1 line of output)
pasted on Oct 4:
1
print("Hello, world!")
view (1 line, 1 line of output)


OCaml:
pasted on Sep 11:
1
print_endline "Hello, World!"
view (1 line, 1 line of output)
pasted on Aug 18:
1
print_string "Hello, world"
view (1 line, 1 line of output)


PHP:
pasted on Oct 15:
1
2
<?php
    echo "Hello world!";
view (2 lines, 1 line of output)
hideath - pasted on Oct 14:
1
2
3
<?
echo "Hello World!"
?>
view (3 lines, 1 line of output)


Perl:
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)


Python:
pasted 4 hours ago:
1
print "Hello world"
view (1 line, 1 line of output)
pasted yesterday:
1
2
3
4
# Python code for "Hello World" 
# nothing else to type...see how simple is the syntax. 
  
print("Hello World")  
view (4 lines, 1 line of output)


Ruby:
pasted on Oct 14:
1
puts "hello world"
view (1 line, 1 line of output)
pasted on Oct 11:
1
puts 'Hello, world!'
view (1 line, 1 line of output)


Scheme:
pasted on Oct 11:
1
2
3
(begin
  (display "Hello, World!")
  (newline))
view (3 lines, 1 line of output)
pasted on Oct 1:
1
(display "Hello World")
view (1 line, 1 line of output)