[ 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 yesterday:
1
2
3
4
5
6
#include <stdio.h>
int main() {
   // printf() displays the string inside quotation
   printf("Hello, World!");
   return 0;
}
view (6 lines, 1 line of output)
pasted yesterday:
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 1 hour 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 1 hour ago:
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
#include <string>
std::string f()
{
    return "hello world";
}
int main()
{
   string test = f();
   std::cout << test;
   return 0;
}
view (12 lines, 1 line of output)


Haskell:
pasted on Mar 17:
1
main = putStrLn "Hello, World!"
view (1 line, 1 line of output)
pasted on Mar 13:
1
2
3
4
module Main (main) where          

main :: IO ()                    
main = putStrLn "Hello, World!"
view (4 lines, 1 line of output)


Lua:
pasted on Jul 26:
1
print("hello world")
view (1 line, 1 line of output)
pasted on Mar 31:
1
print "hello world!"
view (1 line, 1 line of output)


OCaml:
pasted on Mar 8:
1
let () = print_endline("Hello World")
view (1 line, 1 line of output)


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


Perl:
pasted on Mar 6:
1
print("Hello world")
view (1 line, 1 line of output)
pasted on Mar 3:
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 Mar 31:
1
puts "hello world"
view (1 line, 1 line of output)
pasted on Mar 31:
1
puts "hello world"
view (1 line, 1 line of output)


Scheme:
pasted on Mar 26:
1
(display "Hello, World!")
view (1 line, 1 line of output)
pasted on Mar 6:
1
(display "Hello, World!")
view (1 line, 1 line of output)