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


}
view (9 lines, 1 line of output)
pasted 12 hours ago:
1
2
3
4
5
6
#include<stdio.h>

int main(void) {
    puts("Hello World!");
    return 0;
}
view (6 lines, 1 line of output)


Haskell:
pasted on Jun 17:
1
main = putStrLn "hello world"
view (1 line, 1 line of output)
pasted on Jun 9:
1
main = putStrLn "Hello World!"
view (1 line, 1 line of output)


Lua:
pasted on Jun 20:
1
print("Hello World!")
view (1 line, 1 line of output)
pasted on Jun 19:
1
2
3
4
5
6
7
8
9
print("Hello World!")
local ta = {weight=1,S=2,A=3}
for k,v in pairs(ta) do
ta[k] = nil
end

for k,v in pairs(ta) do
	print(k,v)
end
view (9 lines, 1 line of output)


OCaml:
pasted on Jun 18:
1
print_string "Hello world!\n"
view (1 line, 1 line of output)
pasted on Jun 6:
1
print_endline "hello world!";;
view (1 line, 1 line of output)


PHP:
pasted on Jun 22:
1
2
3
<?php
echo "hello world!";
?>
view (3 lines, 1 line of output)
pasted on Jun 18:
1
2
<?php
print 'hello world';
view (2 lines, 1 line of output)


Perl:
pasted on Jun 14:
1
print ("Hello World")
view (1 line, 1 line of output)
pasted on May 24:
1
print "Hello, world\n";
view (1 line, 1 line of output)


Python:
pasted 13 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 Jun 22:
1
puts 'Hello world!'
view (1 line, 1 line of output)
pasted on Jun 17:
1
puts 'Hello, World!'
view (1 line, 1 line of output)


Scheme:
pasted on Jun 19:
1
(display "Hello, World\n")
view (1 line, 1 line of output)
pasted on Jun 19:
1
(display "Hello, World\n")
view (1 line, 1 line of output)