[ 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(void) {
  printf("Hello World\n");
  return 0;
}
view (6 lines, 1 line of output)
pasted yesterday:
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 yesterday:
1
2
3
4
5
6
7
8
9
10
11
12
13
#include<iostream>  
  
using namespace std; 
  
// main function - 
// where the execution of program begins 
int main() 
{ 
    // prints hello world 
    cout<<"Hello World"; 
      
    return 0; 
} 
view (13 lines, 1 line of output)
pasted yesterday:
1
2
3
4
5
6
7
8
9
10
11
12
13
#include<iostream>  
  
using namespace std; 
  
// main function - 
// where the execution of program begins 
int main() 
{ 
    // prints hello world 
    cout<<"Hello World"; 
      
    return 0; 
} 
view (13 lines, 1 line of output)


Haskell:
pasted yesterday:
1
main = putStrLn "Hello World"
view (1 line, 1 line of output)
pasted on Dec 30:
1
main = putStrLn "Hello World"
view (1 line, 1 line of output)


Lua:
pasted on Feb 3:
1
print 'Hello World!'
view (1 line, 1 line of output)
pasted on Jan 30:
1
print ("hello world")
view (1 line, 1 line of output)


OCaml:
pasted on Jan 12:
1
let () = print_string "hello, world" 
view (1 line, 1 line of output)
pasted on Sep 11:
1
print_endline "Hello, World!"
view (1 line, 1 line of output)


PHP:
pasted on Feb 16:
1
<?php echo "hello world"; ?>
view (1 line, 1 line of output)
pasted on Feb 16:
1
<?php echo 'hello world'; ?>
view (1 line, 1 line of output)


Perl:
pasted on Feb 15:
1
2
3
#! /usr/bin/perl

print "Hello, World"
view (3 lines, 1 line of output)
pasted on Feb 4:
1
2
3
4
5
print "Hello World!\n";
my $a ;
if ($a =~ /0|nein/) {
    print "no";
}
view (5 lines, 1 line of output)


Python:
pasted 43 minutes ago:
1
print ('hello world')
view (1 line, 1 line of output)
pasted yesterday:
1
print "Hello World!\n"
view (1 line, 2 lines of output)


Ruby:
pasted on Feb 16:
1
puts 'Hello World'
view (1 line, 1 line of output)
pasted on Feb 10:
1
puts 'hello world!'
view (1 line, 1 line of output)


Scheme:
pasted on Dec 20:
1
(display "Hello World!")
view (1 line, 1 line of output)
pasted on Nov 5:
1
(display "Hello, World!")
view (1 line, 1 line of output)