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

int main(){

    printf("Hello World!\n");
    return 0;
}
view (7 lines, 1 line of output)
pasted 4 hours ago:
1
2
3
4
5
6
7
#include <stdio.h>

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


C++:
pasted 13 hours ago:
1
2
3
4
5
6
7
8
#include <iostream>
 
int main()
{
   // std = standard  cout = character output  << = data direction
   std::cout << "Hello world!";
   return 0;
}
view (8 lines, 1 line of output)
pasted 13 hours ago:
1
2
3
4
5
6
7
8
#include <iostream>
 
int main()
{
   // std = standard  cout = character output  << = data direction
   std::cout << "Hello world!";
   return 0;
}
view (8 lines, 1 line of output)


D:
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)
pasted on Aug 20:
1
2
3
4
5
6
import std.stdio;

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


Haskell:
pasted on Nov 11:
1
main = putStrLn "Hello, World!"
view (1 line, 1 line of output)
pasted on Sep 27:
1
main = putStrLn "Hello, World!"
view (1 line, 1 line of output, 1 comment)


Lua:
pasted on Nov 3:
1
print ("Hello World");
view (1 line, 1 line of output)
pasted on Nov 2:
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)
pasted on Jul 26:
1
print_endline("hello world")
view (1 line, 1 line of output)


PHP:
pasted on Nov 16:
1
<?php echo "Hello World!" ; ?>
view (1 line, 1 line of output)
pasted on Nov 16:
1
2
3
4
5
6
7
8
9
10
<?php
class math{
    function hitung(){
        echo 'hello world';
    }
}
$x = new math();
$var = "hitung";
eval("echo \$x->".$var."();");
?>
view (10 lines, 1 line of output)


Perl:
pasted yesterday:
1
print("hello world");
view (1 line, 1 line of output)
pasted on Nov 17:
1
2
3
4
5
6
7
8
print("Hello World");






exit;
view (13 lines, 1 line of output)


Python:
pasted 4 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 3 hours ago:
1
puts "Hello world!"
view (1 line, 1 line of output)
pasted on Nov 7:
1
puts 'Hello, world!'+"\n"
view (1 line, 1 line of output)


Scheme:
pasted on Nov 16:
1
2
3
4
(begin

  (display "Hello, World!")
)
view (4 lines, 1 line of output)
pasted on Nov 16:
1
2
3
4
5
(begin

  (display "Hello, World!")

  (newline))
view (6 lines, 1 line of output)