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


int main(){

    printf("Hello World");

    return 0;
}
view (9 lines, 1 line of output)


C++:
pasted 21 minutes 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 53 minutes 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 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 21:
1
2
3
4
module Main where

main :: IO ()
main = putStrLn "Hello World"
view (4 lines, 1 line of output)
pasted on Oct 17:
1
main = putStrLn "Hello World"
view (1 line, 1 line of output)


Lua:
pasted on Oct 22:
1
print("hello world")
view (1 line, 1 line of output)
pasted on Oct 21:
1
2
3
4
function xyz()
    print("Hello, World!")
end
xyz()
view (4 lines, 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 2 hours ago:
1
2
3
<?php
   echo "Hello World!";
?>
view (3 lines, 1 line of output)
pasted yesterday:
1
2
3
<?php
    echo "hello world";
?>
view (3 lines, 1 line of output)


Perl:
pasted on Oct 23:
1
print "Hello, World!\n";
view (1 line, 1 line of output)
pasted on Oct 22:
1
2
3
4
5
print "Hello World!\n";
my $string = "RxNoiseGenerator = -1 dB";

print ($string=~/-?\d+(\.\d+)?/);
#print $string;
view (5 lines, 1 line of output)


Python:
pasted yesterday:
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
2
3
#!/usr/local/bin/ruby -w

puts "Hello world!";
view (3 lines, 1 line of output)
pasted yesterday:
1
puts "Hello, world"
view (1 line, 1 line of output)


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