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

int main()
{
   /* my first program in C */
   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 2 hours ago:
1
2
3
4
5
#include"iostream"
int main()
{
cout<<"hello world";
}
view (5 lines, 1 line of output)


D:
pasted on Sep 25:
1
2
3
4
5
6
import std.stdio;

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

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


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


Lua:
pasted 12 hours ago:
1
print("Hello World")
view (1 line, 1 line of output)
pasted on Sep 28:
1
print("Hello World")
view (1 line, 1 line of output)


OCaml:
pasted on Aug 8:
1
2
let x = "hello world";;
Printf.printf "%s" x;;
view (2 lines, 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 3 hours ago:
1
2
3
<?php
print "Hello, World!" ;
?>
view (3 lines, 1 line of output)
pasted 10 hours ago:
1
<?php echo 'Hello, world'; ?>
view (1 line, 1 line of output)


Perl:
pasted 4 hours ago:
1
print "hello world!\n";
view (1 line, 1 line of output)
pasted 11 hours ago:
1
print "hello world\n";
view (2 lines, 1 line of output)


Python:
pasted 46 minutes ago:
1
2
3
#if 0
print "hello world"
#endif
view (3 lines, 1 line of output)
pasted 47 minutes ago:
1
2
#if 0
print "hello world"
view (2 lines, 1 line of output)


Ruby:
pasted on Sep 28:
1
puts "hello world"
view (1 line, 1 line of output)
pasted on Sep 26:
1
puts "hello world"
view (1 line, 1 line of output)


Scheme:
pasted on Sep 18:
1
(display"Hello World!")
view (1 line, 1 line of output)
pasted on Sep 18:
1
(display "Hello World!")
view (1 line, 1 line of output)


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