[ 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 4 hours ago:
1
2
3
4
5
6
7
8
#include <stdio.h>

int main()
{
    printf("Hello, World!\n");

    return 0;
}
view (8 lines, 1 line of output)
pasted 4 hours ago:
1
2
3
4
5
6
7
8
#include <stdio.h>

int main()
{
    printf("Hello, World!\n");

    return 0;
}
view (8 lines, 1 line of output)


C++:
pasted yesterday:
1
2
3
4
5
6
7
8
// Your First C++ Program

#include <iostream>

int main() {
    std::cout << "Hello World!";
    return 0;
}
view (8 lines, 1 line of output)
pasted yesterday:
1
2
3
4
5
6
7
8
// Your First C++ Program

#include <iostream>

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


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


Lua:
pasted on Sep 21:
1
print ("Hello World!")
view (1 line, 1 line of output)
pasted on Sep 21:
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 Sep 28:
1
2
3
<?php

echo "Hello World!" . PHP_EOL;
view (3 lines, 1 line of output)
pasted on Sep 28:
1
2
3
<?php

echo "Hello World!" . PHP_EOL;
view (3 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 yesterday:
1
print("Hello world")
view (1 line, 1 line of output)
pasted on Sep 30:
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 Sep 22:
1
(display "Hello, World!")
view (1 line, 1 line of output)
pasted on Aug 6:
1
(display "Hello, World!")
view (1 line, 1 line of output)