[ 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
void main()
{
   int x = 0;
   printf("Hello, World\n");
}
view (5 lines, 1 line of output)
pasted 6 hours 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 10 hours ago:
1
2
3
4
5
6
#include<iostream>
using namespace std;
int main(){
    cout<<"hello, world"<<endl;
    return 0;
}
view (6 lines, 1 line of output)
pasted 11 hours ago:
1
2
3
4
5
6
7
#include<iostream.h>

int main()
{
cout<<"Hello World";
return 0;
}
view (7 lines, 1 line of output)


D:
pasted on Aug 12:
1
2
3
4
void main()
{
    writef("Hello, world!");
}
view (4 lines, 1 line of output)
pasted on Aug 12:
1
2
3
4
void main()
{
    writef("Hello, World!");
}
view (4 lines, 1 line of output)


Haskell:
pasted on Aug 7:
1
main = putStrLn "Hello, World!"
view (1 line, 1 line of output)
pasted on Aug 1:
1
2
3
4
main = putStrLn "Hello World"

main2 = do putStr "Hello "
           putStrLn "World2"
view (4 lines, 1 line of output)


Lua:
pasted on Aug 12:
1
print("Hello World")
view (1 line, 1 line of output)
pasted on Aug 1:
1
print('Hello World')
view (1 line, 1 line of output)


OCaml:
pasted on Jul 26:
1
print_endline("hello world")
view (1 line, 1 line of output)
pasted on Jul 26:
1
2
print_endline ("hello world")
(* imprime hello world *)
view (2 lines, 1 line of output)


PHP:
pasted on Aug 13:
1
<?php echo "hello world"; ?>
view (1 line, 1 line of output)
pasted on Aug 12:
1
2
3
<?php
    echo "Hello world";
?>
view (3 lines, 1 line of output)


Perl:
pasted on Aug 7:
1
print"hello world";
view (1 line, 1 line of output)
pasted on Aug 6:
1
print ("Hello World \n")
view (1 line, 1 line of output)


Python:
pasted 31 minutes ago:
1
print("Hello world")
view (1 line, 1 line of output)
pasted 32 minutes ago:
1
print("Hello world")
view (1 line, 1 line of output)


Ruby:
pasted on Aug 14:
1
puts "Hello World"
view (1 line, 1 line of output)
pasted on Aug 11:
1
puts "Hello World"
view (1 line, 1 line of output)


Scheme:
pasted on Aug 15:
1
2
(display "Hello, World!")
(newline)
view (2 lines, 1 line of output)
pasted on Aug 15:
1
2
(display "Hello, World!")
(newline)
view (2 lines, 1 line of output)