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

int main (void)
{

printf("%s", "hello world");


return 0;
}
view (10 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 7 minutes ago:
1
2
3
4
5
6
7
#include <iostream>
 
int main()
{
  cout << "Hello World!" << endl;
  return 0;
}
view (7 lines, 1 line of output)
pasted 7 minutes ago:
1
2
3
4
5
6
7
#include <iostream>
 
int main()
{
  cout << "Hello World!" << std::endl;
  return 0;
}
view (7 lines, 1 line of output)


D:
pasted on Dec 1:
1
2
3
4
5
int main(){

    printf("hello world");
    return(0);
}
view (6 lines, 1 line of output)
pasted on Nov 22:
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 on Dec 18:
1
2
module Main where
 main = putStrLn "Hello world!"
view (2 lines, 1 line of output)
pasted on Dec 18:
1
2
module Main where
main = putStrLn "Hello world!"
view (2 lines, 1 line of output)


Lua:
pasted yesterday:
1
print "Hello world!"
view (1 line, 1 line of output)
pasted on Dec 20:
1
2
3
4
5
function say(w)
    print(w)
end

say("Hello World")
view (5 lines, 1 line of output)


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


PHP:
pasted 3 hours ago:
1
2
3
<?php
print "Hello World!"; 
?>
view (3 lines, 1 line of output)
pasted 3 hours ago:
1
2
3
<?php
print "Hello, World!"; 
?>
view (3 lines, 1 line of output)


Perl:
pasted 4 hours ago:
1
print "hello worlD"
view (1 line, 1 line of output)
pasted on Dec 19:
1
2
3
4
5
6
7
8
9
10
11
$fetch = sub { 'hello world'; };
$print = sub { print $_[0]; };

$print->( $fetch->( ) );



$fetch = sub { 'hello world'; };
$print = sub { print UC $_[0]; };

$print->( $fetch->( ) );
view (11 lines, 1 line of output)


Python:
pasted 5 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 yesterday:
1
puts 'hello world'
view (1 line, 1 line of output)
pasted yesterday:
1
puts "Hello World!";
view (1 line, 1 line of output)


Scheme:
pasted on Dec 20:
1
(display "Hello, World!")
view (1 line, 1 line of output)
pasted on Dec 12:
1
(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)