[ create a new paste ] login | about

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

C:
pasted yesterday:
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
6
#include <stdio.h>

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


C++:
pasted yesterday:
1
2
3
4
5
6
7
8
#include <iostream>
using namespace std;

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

int main ()
{
  cout <<"Hello, World";// 输出 “Hello,World!”
  return 0;
}
view (8 lines, 1 line of output)


Haskell:
pasted on Feb 20:
1
2
3
4
module Main
where
main=
    putStrLn "Hello World!"
view (4 lines, 1 line of output)
pasted on Feb 20:
1
2
3
4
module Main
where
main = 
    putStrLn "Hello World!"
view (4 lines, 1 line of output)


Lua:
pasted on May 16:
1
print("Hello World!")
view (1 line, 1 line of output)
pasted on May 15:
1
print("Hello, world!")
view (1 line, 1 line of output)


OCaml:
pasted on Apr 10:
1
print_endline "Hello World!"
view (1 line, 1 line of output)


PHP:
pasted on May 30:
1
2
3
<?php
echo "hello world";
?>
view (3 lines, 1 line of output)
pasted on May 16:
1
2
3
<?php

echo "hello world";
view (3 lines, 1 line of output)


Perl:
pasted on Apr 6:
1
print "Hello World\n";
view (1 line, 1 line of output)
pasted on Mar 16:
1
2
$variable = "Hello World";
print ("$variable");
view (2 lines, 1 line of output)


Python:
pasted yesterday:
1
print('Hello World')
view (1 line, 1 line of output)
pasted on Jun 1:
1
print("Hello world")
view (1 line, 1 line of output)


Ruby:
pasted on May 31:
1
puts "Hello World"
view (1 line, 1 line of output)
pasted on May 30:
1
puts "hello, world"
view (1 line, 1 line of output)


Scheme:
pasted on May 18:
1
(display "Hello, world!")
view (1 line, 1 line of output)
pasted on Mar 16:
1
2
(define x "hello world")
(display x)
view (3 lines, 1 line of output)