[ 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 3 hours ago:
1
2
3
4
5
6
7
8
9
#include <stdio.h>
 
int main(int argc, const char * argv[])
{
 
    // insert code here...
    printf("Hello, World!\n");
    return 0;
}
view (9 lines, 1 line of output)
pasted 3 hours ago:
1
2
3
4
5
6
7
8
9
#include <stdio.h>
 
int main(int argc, const char * argv[])
{
 
    // insert code here...
    printf("Hello, World!\n");
    return 0;
}
view (9 lines, 1 line of output)


C++:
pasted yesterday:
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 yesterday:
1
2
3
4
5
6
7
#include<iostream>
using namespace std;

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


D:
pasted on Dec 8:
1
2
3
4
5
6
import std.stdio;

void main()
{
    writefln("Hello, World!");
}
view (6 lines, 1 line of output)
pasted on Aug 30:
1
2
3
4
5
6
import std.stdio;

void main()
{
    writefln("Hello, World!");
}
view (6 lines, 1 line of output)


Haskell:
pasted on Feb 8:
1
2
main = do
    putStrLn "hello world"
view (2 lines, 1 line of output)
pasted on Jan 26:
1
2
import System.Random
main = putStr "hello world"
view (2 lines, 1 line of output)


Lua:
pasted on Feb 12:
1
print "Hello world"
view (1 line, 1 line of output)
pasted on Feb 9:
1
print ("Hello world")
view (1 line, 1 line of output)


OCaml:
pasted on Nov 3:
1
let () = print_endline "Hello, World!"
view (1 line, 1 line of output)


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


Perl:
pasted 8 hours ago:
1
print("hello world!");
view (1 line, 1 line of output)
pasted 8 hours ago:
1
print("hello world!");
view (1 line, 1 line of output)


Python:
pasted 3 hours ago:
1
print 'Hello world'
view (1 line, 1 line of output)
pasted 7 hours ago:
1
print("Hello world!")
view (1 line, 1 line of output)


Ruby:
pasted on Feb 15:
1
print "Hello World"
view (1 line, 1 line of output)
maezi - pasted on Feb 12:
1
puts"Hello World"
view (1 line, 1 line of output)


Scheme:
pasted on Feb 2:
1
(display "Hello World")
view (1 line, 1 line of output)
pasted on Jan 29:
1
2
3
4
(begin

  (display "Hello, World!")
)
view (4 lines, 1 line of output)