[ 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 31 minutes ago:
1
2
3
4
5
#include<stdio.h>
void main()
{
printf("Hello world");
}
view (5 lines, 1 line of output)
pasted 49 minutes ago:
1
2
3
4
5
int main(void)
{
printf("Hello, World!");
return 0;
}
view (5 lines, 1 line of output)


C++:
pasted 59 minutes ago:
1
2
3
4
5
6
7
8
9
10
#include <iostream> 


int main() 
{    
   using namespace std;

cout << "Hello world!" << endl;   
return 0;
 }
view (10 lines, 1 line of output)
pasted 1 hour ago:
1
2
3
4
5
6
7
8
9
10
#include <iostream> 


int main() 
{    
   using namespace std;

cout << "Hello world!" << endl;   
return 0;
 }
view (10 lines, 1 line of output)


D:
pasted on Oct 17:
1
2
3
4
int main() {
    printf("Hello World");
    return 0;
}
view (4 lines, 1 line of output)
pasted on Oct 12:
1
2
3
4
int main() {
    printf("Hello World");
    return 0;
}
view (4 lines, 1 line of output)


Haskell:
pasted on Oct 17:
1
main = putStrLn "Hello World"
view (1 line, 1 line of output)
pasted on Oct 12:
1
2
square x = x * x
main = putStrLn "Hello, World!"
view (2 lines, 1 line of output)


Lua:
pasted on Oct 16:
1
print "Hello world!"
view (1 line, 1 line of output)
pasted on Oct 16:
1
print "Hello world!"
view (1 line, 1 line of output)


OCaml:
pasted on Oct 9:
1
print_string "Hello World!\n";;
view (1 line, 1 line of output)
pasted on Aug 8:
1
2
let x = "hello world";;
Printf.printf "%s" x;;
view (2 lines, 1 line of output)


PHP:
pasted 56 minutes ago:
1
2
3
4
5
6
<?php

$hello = 'Hello world';
$hello = (unset) print $hello;
print $hello;
?>
view (6 lines, 1 line of output)
pasted 1 hour ago:
1
<?php echo 'Hello, world'; ?>
view (1 line, 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 yesterday:
1
2
3
4
#!/usr/bin/perl

# This will print "Hello, World"
print "Hello, world\n";
view (4 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 on Oct 19:
1
puts "Hello, world!"
view (1 line, 1 line of output)
pasted on Oct 17:
1
puts "hello world"
view (1 line, 1 line of output)


Scheme:
pasted on Oct 14:
1
(display "Hello, World!")
view (1 line, 1 line of output)
pasted on Oct 7:
1
(display "Hello, World!")
view (1 line, 1 line of output)


Tcl:
pasted on Oct 6:
1
puts -nonewline "Hello world!"
view (1 line, 1 line of output)
pasted on Jul 31:
1
puts -nonewline "Hello world!"
view (1 line, 1 line of output)