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

int main()
{
  short s = 1;

 if(s&0x000f == 0)
    printf("LE\n");

 printf("Hello World\n");
 return 0;

}
view (13 lines, 1 line of output)
pasted 22 minutes ago:
1
2
3
4
5
6
7
8
9
#include <stdio.h>

int main()
{

 printf("Hello World\n");
 return 0;

}
view (9 lines, 1 line of output)


C++:
pasted 1 hour ago:
1
2
3
4
5
6
7
#include <iostream>
 
int main()
{
  std::cout << "Hello World!" << std::endl;
  return 0;
}
view (7 lines, 1 line of output)
pasted 1 hour ago:
1
2
3
4
5
6
7
#include <iostream>
 
int main()
{
  std::cout << "Hello World!" << std::endl;
  return 0;
}
view (7 lines, 1 line of output)


D:
pasted on Jul 18:
1
2
3
4
5
6
import std.stdio;

void main()
{
    writef("Hello, world");
}
view (6 lines, 1 line of output)
pasted on Jun 17:
1
2
3
4
5
import std.stdio;

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


Haskell:
pasted on Jul 25:
1
2
3
module Main where

main = putStrLn "Hello, World!"
view (3 lines, 1 line of output)
pasted on Jul 25:
1
main = putStrLn "Hello World"
view (1 line, 1 line of output)


Lua:
pasted on Jul 23:
1
print("Hello World!")
view (1 line, 1 line of output)
pasted on Jul 23:
1
print("Hello World!")
view (1 line, 1 line of output)


OCaml:
pasted on Jun 5:
1
 print_endline "Hello world!";;
view (1 line, 1 line of output)
pasted on Jun 5:
1
print_string "Hello world!\n";;
view (1 line, 1 line of output)


PHP:
pasted on Jul 26:
1
2
3
4
5
<?php

echo "hello world";

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


Perl:
pasted on Jul 26:
1
2
3
4
5
6
use strict;
use warnings;

my $hello_world = "Hello, world!";

print $hello_world;
view (6 lines, 1 line of output)
pasted on Jul 26:
1
print "Hello World";
view (1 line, 1 line of output)


Python:
pasted 3 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 Jul 25:
1
(begin (display "Hello World!") (newline))
view (1 line, 1 line of output)
pasted on Jul 22:
1
2
3
4
(display "Hello World")
(newline)
(cons 1 '()) 
(define test (list 1 1 2 3 5))
view (4 lines, 1 line of output)


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