[ 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 ]

C:
pasted yesterday:
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 yesterday:
1
2
3
4
#include<stdio.h>

void main(){
printf("hello world");}
view (4 lines, 1 line of output)


C++:
pasted 8 minutes ago:
1
2
3
4
5
6
#include <iostream> 
using namespace std;
int main(void)
{
    cout << "hello world";
}
view (6 lines, 1 line of output)
zhangxiaomu01@gmail.com - pasted 3 hours ago:
1
2
3
4
5
6
#include <iostream>
using namespace std;
int main(){
    cout << "hello world" <<endl;
    
}
view (6 lines, 1 line of output)


D:
pasted on Dec 8:
1
2
3
4
5
6
import std.stdio;

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


Haskell:
pasted on Apr 24:
1
main = putStrLn "Hello World"
view (1 line, 1 line of output)
pasted on Mar 26:
1
main = putStrLn "Hello, world!"
view (1 line, 1 line of output)


Lua:
pasted on May 21:
1
print("Hello World")
view (1 line, 1 line of output)
pasted on May 15:
1
print("Hello, World!");
view (1 line, 1 line of output)


OCaml:
pasted on Mar 20:
1
2
3
4
5
6
let main _ = 
    Printf.printf "Hello World"


let () =
    main ()
view (6 lines, 1 line of output)
pasted on Mar 4:
1
print_endline "Hello World!"
view (1 line, 1 line of output)


PHP:
pasted on May 22:
1
2
3
4
5
<?php

echo "Hello World";

?>
view (5 lines, 1 line of output)
pasted on May 22:
1
2
<?php
echo 'hello world';
view (2 lines, 1 line of output)


Perl:
pasted yesterday:
1
print "Hello, world\n";
view (1 line, 1 line of output)
pasted on May 12:
1
2
3
4
use strict;
use warnings;
print "hello world";
print $_ , "\n", for %ENV;
view (4 lines, 1 line of output)


Python:
pasted 3 hours ago:
1
2
3
import random

print("Hello, World")
view (3 lines, 1 line of output)
pasted 5 hours ago:
1
print('Hello World!')
view (1 line, 1 line of output)


Ruby:
pasted on May 20:
1
puts "Hello, world!"
view (3 lines, 1 line of output)
pasted on May 13:
1
print "Hello, World!\n"
view (1 line, 1 line of output)


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