[ 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 | Tcl ]

C:
pasted 1 minute ago:
1
2
3
4
5
6
#include<stdio.h>
int main(void)
{
    printf("hello world");
    return 0;
}
view (6 lines, 1 line of output)
pasted 33 minutes ago:
1
2
3
4
5
6
#include<stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}
view (7 lines, 1 line of output)


C++:
pasted 27 minutes ago:
#include <iostream>

int main()
{
    // upon declaration
    char stuff[] = "hello world";

    /*
    // individiually
    stuff[0] = 'h';
    stuff[1] = 'e';
    stuff[2] = 'l';
    stuff[3] = 'l';
    stuff[4] = 'o';
    stuff[5] = ' ';
    stuff[6] = 'w';
    stuff[7] = 'o';
    stuff[8] = 'r';
    stuff[9] = 'l';
    stuff[10] = 'd';
    */

    cout << stuff;

}
view (25 lines, 1 line of output)
pasted 28 minutes ago:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>

int main()
{
    char stuff[] = "hello world";

    /*stuff[0] = 'h';
    stuff[1] = 'e';
    stuff[2] = 'l';
    stuff[3] = 'l';
    stuff[4] = 'o';
    stuff[5] = ' ';
    stuff[6] = 'w';
    stuff[7] = 'o';
    stuff[8] = 'r';
    stuff[9] = 'l';
    stuff[10] = 'd';*/

    cout << stuff;

}
view (21 lines, 1 line of output)


D:
pasted yesterday:
1
2
3
4
5
6
import std.stdio;

void main(string[] args)
{
    writefln("Hello world!");
}
view (6 lines, 1 line of output)
pasted on Nov 21:
1
2
3
4
5
6
import std.stdio;

void main(string[] args)
{
    writefln("Hello world!");
}
view (6 lines, 1 line of output)


Haskell:
pasted yesterday:
1
2
3
4
module Main where
 
main :: IO ()
main = putStrLn "Hello, World!"
view (4 lines, 1 line of output)
pasted on Nov 21:
1
2
3
main :: IO()
main
   = putStr "Hello World"
view (3 lines, 1 line of output)


Lua:
pasted on Nov 21:
1
2
3
4
5
print"Hello World!"

Lol = [[Multiple lines of text
>> can be enclosed in double square
>> brackets.]]
view (5 lines, 1 line of output)
pasted on Nov 21:
1
2
3
4
5
print"Hello World!"

Lol = [[Multiple lines of text
>> can be enclosed in double square
>> brackets.]]
view (5 lines, 1 line of output)


OCaml:
pasted on Nov 13:
1
print_string "Hello, world!\n";;
view (1 line, 1 line of output)
pasted on Nov 13:
1
print_string "Hello World!"
view (1 line, 1 line of output)


PHP:
pasted yesterday:
1
<?php echo 'Hello, world'; ?>
view (1 line, 1 line of output)
pasted yesterday:
1
2
3
<?php
print "Hello World";
?>
view (3 lines, 1 line of output)


Perl:
pasted yesterday:
1
2
3
#!/usr/bin/perl

print "Hello World!\n";
view (3 lines, 1 line of output)
pasted on Nov 21:
1
2
#!/usr/bin/perl
print "Hello, world!\n";
view (2 lines, 1 line of output)


Python:
pasted 1 hour ago:
1
print("Hello World")
view (1 line, 1 line of output)
pasted 1 hour ago:
1
print("Hello World")
view (1 line, 1 line of output)


Ruby:
pasted yesterday:
1
puts "Hello, World!"
view (1 line, 1 line of output)
pasted on Nov 21:
1
2
3
4
5
6
7
8
def curry(cb, *args)
    result = Proc.new do |*new_args|
        puts "hello world"
    end
end

q = curry('x')
q.call
view (8 lines, 1 line of output)


Scheme:
pasted on Nov 21:
1
(display "Hello, World!")
view (1 line, 1 line of output)
pasted on Nov 17:
1
2
(+ 2 3 3)
(display "hello world")
view (2 lines, 1 line of output)


Tcl:
er_vikram190@hotmail.com - pasted on Nov 9:
1
puts -nonewline "Hello world"
view (1 line, 1 line of output)
pasted on Nov 4:
1
puts -nonewline "Hello world"
view (1 line, 1 line of output)