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


C++:
pasted 4 hours ago:
1
2
3
4
5
6
7
8
#include <stdio.h>

int main()
{
    printf("Hello World");

    return 0;
}
view (8 lines, 1 line of output)
pasted 4 hours ago:
1
2
3
4
5
6
7
8
#include <stdio.h>

int main()
{
    printf("Hello World");

    return 0;
}
view (8 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 yesterday:
1
main = putStrLn "Hello world";
view (1 line, 1 line of output)
pasted on Mar 8:
1
main = putStrLn "Hello, World!"
view (1 line, 1 line of output)


Lua:
Yvhjv - pasted on Mar 18:
1
print("Hello World!")
view (1 line, 1 line of output)
pasted on Mar 18:
1
print("Hello World")
view (1 line, 1 line of output)


OCaml:
pasted 18 hours ago:
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 yesterday:
1
Hello, World!
view (1 line, 1 line of output)
pasted yesterday:
1
2
3
<?php
echo "Hello World!";
?>
view (3 lines, 1 line of output)


Perl:
pasted on Mar 9:
1
2
3
#!/usr/bin/perl
		
print "Hello, World!\n";
view (3 lines, 1 line of output)
pasted on Feb 26:
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/perl
#
# The traditional first program.
 
# Strict and warnings are recommended.
use strict;
use warnings;
 
# Print a message.
print "Hello, World!\n";
view (10 lines, 1 line of output)


Python:
pasted 5 hours ago:
1
print('Hello World')
view (1 line, 1 line of output)
pasted 10 hours ago:
1
print('Hello World!')
view (1 line, 1 line of output)


Ruby:
pasted on Mar 13:
1
puts "Hello, World"
view (1 line, 1 line of output)
pasted on Mar 12:
1
2
3
#!/usr/bin/ruby
 
puts "Hello World!";
view (4 lines, 1 line of output)


Scheme:
pasted on Mar 11:
1
(display "Hello, World!")
view (1 line, 1 line of output)
pasted on Feb 2:
1
(display "Hello World")
view (1 line, 1 line of output)