[ 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 3 hours 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)
pasted 6 hours ago:
1
2
3
4
5
6
7
#include <stdio.h>

int main()
{
    printf("hello world!\n");
    return 0;
}
view (7 lines, 1 line of output)


C++:
pasted 5 hours ago:
1
2
3
4
5
6
7
//my first c++ code
#include <iostream>

int main()
{
std::cout << "hello world";
}
view (7 lines, 1 line of output)
pasted 5 hours ago:
1
2
3
4
5
6
7
8
9
#include <iostream>
#include <vector>

using namespace std;

int main() {
    cout << "Hello World!" << endl;
    return 0;
}
view (14 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)
pasted on Aug 30:
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
3
4
module Main
  where

main=putStrLn "Hello, World!"
view (4 lines, 1 line of output)
pasted on Nov 21:
1
main = putStrLn "Hello, World!"
view (1 line, 1 line of output)


Lua:
pasted on Dec 3:
1
print("hello world")
view (1 line, 1 line of output)
pasted on Dec 3:
1
print("hello world")
view (1 line, 1 line of output)


OCaml:
pasted on Nov 3:
1
let () = print_endline "Hello, World!"
view (1 line, 1 line of output)
pasted on Jul 26:
1
print_endline("hello world")
view (1 line, 1 line of output)


PHP:
pasted 12 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 Nov 28:
1
2
3
4
5
my $x = 5;

eval {$a = $x/0};

print "Hello world";
view (5 lines, 1 line of output)
pasted on Nov 18:
1
print("hello world");
view (1 line, 1 line of output)


Python:
pasted 1 hour ago:
1
print('hello world')
view (1 line, 1 line of output)
pasted 2 hours ago:
1
print("hello world")
view (1 line, 1 line of output)


Ruby:
pasted yesterday:
1
print("Hello World")
view (1 line, 1 line of output)
pasted on Nov 27:
1
puts 'hello world'
view (1 line, 1 line of output)


Scheme:
pasted on Nov 16:
1
2
3
4
(begin

  (display "Hello, World!")
)
view (4 lines, 1 line of output)
pasted on Nov 16:
1
2
3
4
5
(begin

  (display "Hello, World!")

  (newline))
view (6 lines, 1 line of output)