[ 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
7
8
9
#include "stdio.h"

int main ()
{
    printf("Hello world");
    
    return 0;
    
}
view (9 lines, 1 line of output)
pasted 1 hour ago:
1
2
3
4
5
6
#include <stdio.h>
int main()
{
     printf("hello world \n");
     return 0;
}
view (6 lines, 1 line of output)


C++:
pasted 33 minutes ago:
1
2
3
4
5
6
7
#include <iostream>
//using namespace std;
int main()
{
cout << "Hello World";
return 0;
}
view (7 lines, 1 line of output)
pasted 50 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 Jan 27:
1
2
3
4
5
6
7
import std.stdio;

int main(char[][] args)
{
  writef("Hello world!");
  return 0;
}
view (7 lines, 1 line of output)
pasted on Nov 22:
1
2
3
4
5
6
7
import std.stdio;

int main(char[][] args)
{
  writef("Hello world!");
  return 0;
}
view (7 lines, 1 line of output)


Haskell:
pasted on Feb 4:
1
2
main :: IO ()
main = putStrLn "Hello, World!"
view (2 lines, 1 line of output)
pasted on Feb 1:
1
2
main :: IO ()
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 yesterday:
1
print("Hello World")
view (1 line, 1 line of output)


OCaml:
pasted on Jan 23:
1
Printf.printf "Hello world!\n";;
view (1 line, 1 line of output)
pasted on Nov 13:
1
print_string "hello world";;
view (1 line, 1 line of output)


PHP:
pasted yesterday:
1
2
3
4
5
6
7
8
9
<?php

function test() {

return "hello world";

}

echo test();
view (9 lines, 1 line of output)
pasted yesterday:
1
2
3
<?php 
    echo "hello world";
?>
view (3 lines, 1 line of output)


Perl:
pasted yesterday:
1
2
3
4
5
sub Hello{
    print "Hello, World"
}

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


Python:
Efrahim - pasted 42 minutes ago:
1
2
#print function will show hello world */
print "hello world"
view (2 lines, 1 line of output)
RichardEames - pasted 1 hour ago:
1
print 'Hello, world!'
view (1 line, 1 line of output)


Ruby:
pasted on Feb 6:
1
puts "hello world"
view (1 line, 1 line of output)
pasted on Feb 5:
1
puts "hello world"
view (1 line, 1 line of output)


Scheme:
pasted on Feb 2:
1
(display "Hello, world")
view (1 line, 1 line of output)
pasted on Jan 27:
1
(display "Hello, world!")
view (1 line, 1 line of output)


Tcl:
pasted on Jan 29:
1
2
set hello "Hello, World!"
puts -nonewline $hello ;
view (2 lines, 1 line of output)
pasted on Sep 12:
1
2
3
set hello "Hello, World!"
puts -nonewline $hello ; #$hello
#puts "World!"
view (3 lines, 1 line of output)