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

int main(){
float f = 7.32;
int int1, int2;

printf("Hello World");

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


C++:
pasted 2 hours ago:
1
2
3
4
5
6
7
8
// my first program
#include <iostream>
using namespace std;
int main()
{
   cout << "Hello World";
   return 0;
}
view (9 lines, 1 line of output)
pasted 3 hours ago:
1
2
3
4
5
6
7
#include <iostream>

int main()
{
    std::cout << "Hello WOrld!";
    return 0;
}
view (7 lines, 1 line of output)


Haskell:
pasted on Jul 1:
1
2
3
4
module Main where

main :: IO ()
main = putStrLn "Hello World!"
view (4 lines, 1 line of output)
pasted on Jun 28:
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 on Jul 1:
1
print "hello world"
view (1 line, 1 line of output)


OCaml:
pasted on Mar 28:
1
print_string "Hello world!\n"
view (1 line, 1 line of output)
pasted on Mar 28:
1
print_string "Hello world!\n";
view (1 line, 1 line of output)


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


Perl:
pasted on Jun 24:
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)
pasted on Jun 12:
1
print "Hello, World!\n";
view (1 line, 1 line of output)


Python:
pasted 1 hour ago:
1
print "Hello world"
view (1 line, 1 line of output)
pasted 2 hours ago:
1
print("Hello World")
view (1 line, 1 line of output)


Ruby:
pasted on Jun 23:
1
puts "Hello World"
view (1 line, 1 line of output)
pasted on Jun 23:
1
puts "hello world"
view (1 line, 1 line of output)


Scheme:
pasted on Apr 14:
1
(display "Hello, World")
view (1 line, 1 line of output)
pasted on Apr 11:
1
(display "Hello, World")
view (1 line, 1 line of output)