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

void main(int argc,char *argv[])
{
    fprintf(stdout,"hello world\n");
}
view (6 lines, 1 line of output)
pasted 5 hours ago:
1
2
3
4
5
6
7
#include <stdio.h>

int main() {
	printf("Hello World! \n");

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


C++:
pasted yesterday:
1
2
3
4
5
6
#include <iostream>

int main() {
    std::cout << "Hello World!";
    return 0;
}
view (6 lines, 1 line of output)
pasted yesterday:
1
2
3
4
5
6
7
# include<iostream>
using namespace std;
int main()
{
  cout<<"hello world";
  return 0;
}
view (7 lines, 1 line of output)


Haskell:
pasted on Nov 25:
1
2
main = 
    putStrLn "Hello, World!"
view (2 lines, 1 line of output)
pasted on Nov 23:
1
2
3
addIt x y = x + y

main = putStrLn "hello world"
view (4 lines, 1 line of output)


Lua:
pasted on Nov 18:
1
print("Hello World!")
view (1 line, 1 line of output)
pasted on Nov 17:
1
print("Hello world")
view (1 line, 1 line of output)


PHP:
LemmyRock - pasted on Nov 27:
1
2
3
<?php
    echo "Hello, world!";
?>
view (3 lines, 1 line of output)
pasted on Nov 26:
1
2
<?php
echo "Hello world";
view (2 lines, 1 line of output)


Perl:
pasted on Nov 13:
1
print "Hello, world\n";
view (1 line, 1 line of output)
pasted on Nov 2:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl

# This is a single line comment
print "Hello, world\n";

=begin comment
This is all part of multiline comment.
You can use as many lines as you like
These comments will be ignored by the 
compiler until the next =cut is encountered.
=dasfdfadf
df
dfdfad

print "Hello, world\n";
view (15 lines, 1 line of output)


Python:
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)


Ruby:
pasted 3 hours ago:
1
puts "Hello World"
view (1 line, 1 line of output)
pasted on Nov 23:
1
2
# Hello World Program in Ruby
puts "Hello World!";
view (2 lines, 1 line of output)


Scheme:
pasted on Nov 6:
1
(display "Hello, World!")
view (1 line, 1 line of output)
pasted on Oct 18:
1
(display "Hello, World!")
view (1 line, 1 line of output)