[ create a new paste ] login | about

Listed below are example programs that print "hello world", written in the following languages:
[ C | C++ | Haskell | Lua | PHP | Perl | Python | Ruby | Scheme ]

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

main()
{
  printf("Hello world");
  return 0;
}
view (7 lines, 1 line of output)
pasted 6 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)


C++:
pasted 21 minutes ago:
1
2
3
4
5
6
7
8
9
// Your First C++ Program

#include <iostream>

int main() 
{
    std::cout << "Hello World!";
    return 0;
}
view (9 lines, 1 line of output)
pasted 21 minutes ago:
1
2
3
4
5
6
7
8
// Your First C++ Program

#include <iostream>

int main() {
    std::cout << "Hello World!";
    return 0;
}
view (8 lines, 1 line of output)


Haskell:
pasted on Sep 3:
1
2
main = 
    putStrLn "Hello, World!"
view (2 lines, 1 line of output, 3 comments)
pasted on Aug 30:
1
main = putStrLn "hello world"
view (1 line, 1 line of output, 3 comments)


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)


PHP:
pasted on Sep 26:
1
2
3
<?php
    echo "Hello World"
?>
view (3 lines, 1 line of output)
sueide - pasted on Sep 25:
1
2
3
4
5
<?php

echo "Hello World";

?>
view (5 lines, 1 line of output)


Perl:
pasted on Sep 20:
1
2
3
#Hello World
%c=qw(> $p++ < $p-- + D=(D+1)%256 - D=(D-1)%256 [ while(D){ ] } . print+chrD , D=ord(getc));
$/=$,;$_='++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.';s/./$c{$&};/g;s[D]'$b[$p]'g;eval
view (3 lines, 1 line of output, 3 comments)
pasted on Sep 3:
1
print "hello world!";
view (1 line, 1 line of output, 3 comments)


Python:
pasted 3 hours ago:
1
print("hello world")
view (1 line, 1 line of output)
pasted 15 hours ago:
1
print("hello, world")
view (1 line, 1 line of output)


Ruby:
pasted on Sep 17:
1
puts "Hello World"
view (1 line, 1 line of output, 3 comments)
pasted on Sep 14:
1
puts "hello World"
view (1 line, 1 line of output)


Scheme:
pasted on Aug 29:
1
(display "Hello, world!")
view (1 line, 1 line of output)
pasted on Aug 23:
1
(display "Hello, World!")
view (1 line, 1 line of output, 3 comments)