[ 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 | PHP | Perl | Python | Ruby | Scheme ]

C:
pasted 4 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)
pasted yesterday:
1
2
3
4
5
int main()
{
    printf("hello world");
    return 0;
}
view (5 lines, 1 line of output)


C++:
pasted on Jun 19:
1
2
3
4
5
6
7
8
9
#include <iostream>

using namespace std;

int main(){

cout << "Hello World" << endl;
return 0;
}
view (9 lines, 1 line of output)
pasted on Jun 19:
1
2
3
4
5
#include <stdio.h>
int main (void)
{
    printf("hello world\n");
}
view (5 lines, 1 line of output)


D:
pasted on Jun 10:
1
2
3
4
void main()
{
    writef("Hello, World!");
}
view (6 lines, 1 line of output)
pasted on Jun 10:
1
2
3
4
5
6
import std.stdio;

void main()
{
    writef("Hello, World!");
}
view (6 lines, 1 line of output)


Haskell:
pasted 5 hours ago:
1
2
3
	

main = putStrLn "Hello, world!"
view (4 lines, 1 line of output)
pasted on Jun 18:
1
main = putStrLn "Hello, world!"
view (1 line, 1 line of output)


Lua:
pasted on Jun 19:
1
2
3
4
5
6
7
-- program "Hello World"
    print("Hello World")
function fatorial (n)
    if n == 0 then return 1
    else return n * fatorial (n-1)
    end
end
view (7 lines, 1 line of output)
pasted on Jun 19:
1
2
-- program "Hello World"
    print("Hello World")
view (2 lines, 1 line of output)


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

echo("Hello World");

?>
view (5 lines, 1 line of output)
pasted yesterday:
1
2
3
4
5
6
7
<?php

echo "Hello World!";



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


Perl:
pasted on Jun 10:
1
print "hello world"
view (1 line, 1 line of output)
pasted on Jun 9:
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 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 on Jun 19:
1
puts "hello world"
view (1 line, 1 line of output)
pasted on Jun 16:
1
print("Hello World")
view (1 line, 1 line of output)


Scheme:
pasted on Jun 10:
1
(display "hello world")
view (1 line, 1 line of output)
pasted on May 25:
1
(display "Hello World")
view (1 line, 1 line of output)