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

int main(){
printf("Hello World");
return 0;
}
view (6 lines, 1 line of output)
pasted 4 hours ago:
1
2
3
4
5
6
7
8
9
10
11
12
#include <stdio.h>

PrintHello()
{
printf("Hello World/n");
}

int main()
{
printf("Hello World");
return 0;
}
view (12 lines, 1 line of output)


C++:
pasted 6 hours ago:
1
2
3
4
5
6
#include <stdio.h>
#include <stdlib.h>
int main() {
    printf("Hello world");
    return 0;
}
view (6 lines, 1 line of output)
pasted 6 hours ago:
1
2
3
4
5
6
7
8
9
10
#include <iostream>

// Kommentar

int main()
{
    std::cout << "Hello World!" << std::endl;

    return 0;
}
view (10 lines, 1 line of output)


Haskell:
pasted on Jan 15:
1
main = putStrLn "Hello World"
view (1 line, 1 line of output)
pasted on Jan 12:
1
main = putStrLn "Hello, World!"
view (1 line, 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)


PHP:
pasted yesterday:
1
2
3
4
5
<?php

print("Hello, World!");

?>
view (5 lines, 1 line of output)
pasted yesterday:
1
2
3
<?php
print("Hello, World!");
?>
view (3 lines, 1 line of output)


Perl:
pasted on Dec 23:
1
2
3
4
5
6
7
8
#!/usr/bin/perl


print "Hello World\n";

=pod

=cut
view (8 lines, 1 line of output)
pasted on Dec 17:
1
print 'hello world';
view (1 line, 1 line of output)


Python:
pasted 4 hours ago:
1
print("hello world")
view (1 line, 1 line of output)
pasted 7 hours ago:
1
print("Hello World!")
view (1 line, 1 line of output)


Ruby:
pasted on Jan 14:
1
puts "Hello World!";
view (1 line, 1 line of output)
pasted on Jan 9:
1
puts 'hello world'
view (1 line, 1 line of output)


Scheme:
pasted 18 hours ago:
1
(display "Hello, World!")
view (1 line, 1 line of output)
pasted on Jan 14:
1
(display "Hello, World!")
view (1 line, 1 line of output)