[ 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 1 hour ago:
1
2
3
4
5
#include <stdio.h>
int main() {
	printf("Hello, world!\n");
	return 0;
}
view (5 lines, 1 line of output)
pasted 2 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 on Sep 2:
1
2
3
4
5
6
7
8
9
10
11
#include<iostream>

using namespace std;

int main(){

        cout<<"Hello World!"<<endl;

return 0;

}
view (11 lines, 1 line of output)
pasted on Sep 2:
1
2
3
4
5
6
7
8
9
10
11
#include<iostream>

using namespace std;

int main(){

        cout<<"Hello World!"<<endl;

return 0;

}
view (11 lines, 1 line of output)


Haskell:
pasted on Jun 13:
1
main = do { putStrLn "Hello World"; }
view (1 line, 1 line of output)


Lua:
gerson - pasted on Aug 26:
1
print("hello, world!")
view (1 line, 1 line of output)
pasted on Jul 14:
1
print("Hello World")
view (1 line, 1 line of output)


OCaml:
pasted on Apr 10:
1
print_endline "Hello World!"
view (1 line, 1 line of output)


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


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


Python:
pasted on Sep 2:
1
print("hello world")
view (1 line, 1 line of output)
pasted on Sep 1:
1
print("hello world")
view (1 line, 1 line of output)


Ruby:
pasted on Jul 31:
1
puts "Hello, World!"
view (1 line, 1 line of output)
pasted on Jul 14:
1
2
3
a = 'hello world'

print a
view (3 lines, 1 line of output)


Scheme:
pasted on Aug 6:
1
(display "Hello, World!")
view (1 line, 1 line of output)
pasted on Jun 20:
1
(display "hello world")
view (1 line, 1 line of output)