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

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


C++:
pasted 10 hours ago:
1
2
3
4
5
6
7
8
9
10
11
12
      #include <iostream>
    using namespace std;
    void print (char * a)
    {
        cout << a << endl;
    }
    int main ()
    {
        const char * a = "Hello world";
        print(const_cast<char *> (a) );
        return 0;
    }
view (23 lines, 1 line of output)
pasted yesterday:
1
2
3
4
5
6
7
#include <iostream.h>
using namespace std;
int main() 
{
    cout << "Hello, World!";
    return 0;
}        
view (7 lines, 1 line of output)


Haskell:
pasted on Dec 30:
1
main = putStrLn "Hello World"
view (1 line, 1 line of output)
pasted on Dec 28:
1
2
main = putStrLn "Hello, world!"
main2 = putStrLn "Hi wo!"
view (2 lines, 1 line of output)


Lua:
pasted on Jan 25:
1
print("Hello World!")
view (1 line, 1 line of output)
pasted on Jan 24:
1
print("Hello World!")
view (1 line, 1 line of output)


OCaml:
pasted on Jan 12:
1
let () = print_string "hello, world" 
view (1 line, 1 line of output)
pasted on Sep 11:
1
print_endline "Hello, World!"
view (1 line, 1 line of output)


PHP:
pasted 2 hours ago:
1
2
<?php
echo "Hello World";
view (2 lines, 1 line of output)
pasted on Jan 25:
1
2
3
<?php
echo "hello world";
?>
view (3 lines, 1 line of output)


Perl:
pasted on Jan 18:
1
2
3
#script begins
print("hello world")
#script ends
view (3 lines, 1 line of output)
pasted on Jan 14:
1
print('Hello World')
view (1 line, 1 line of output)


Python:
pasted 2 hours ago:
1
print("hello world")
view (1 line, 1 line of output)
pasted yesterday:
1
print("Hello World")
view (1 line, 1 line of output)


Ruby:
pasted on Jan 23:
1
printf "hello world" ;
view (1 line, 1 line of output)
pasted on Jan 23:
1
puts "hello world"
view (1 line, 1 line of output)


Scheme:
pasted on Dec 20:
1
(display "Hello World!")
view (1 line, 1 line of output)
pasted on Nov 5:
1
(display "Hello, World!")
view (1 line, 1 line of output)