[ 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 3 hours ago:
1
2
3
4
5
6
7
#include <stdio.h>
int main() {
   // printf() displays the string inside quotation
   printf("Hello, World!");
   return 0;
}
 
view (7 lines, 1 line of output)
pasted 9 hours ago:
1
2
3
4
5
6
#include <stdio.h>
int main() {
   // printf() displays the string inside quotation
   printf("Hello, World!");
   return 0;
}
view (6 lines, 1 line of output)


C++:
pasted 5 hours ago:
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)
pasted 13 hours ago:
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 18:
1
2
main = putStrLn "Hello, world!"
main2 = putStrLn "Hi wo!"
view (2 lines, 1 line of output)
pasted on Nov 18:
1
main = putStrLn "Hello, world!"
view (1 line, 1 line of output)


Lua:
pasted yesterday:
1
2
3
4
say = print
hi = ("Hello World")

say(hi)
view (4 lines, 1 line of output)
pasted yesterday:
1
2
3
bruh = print

bruh("Hello World")
view (3 lines, 1 line of output)


OCaml:
pasted on Sep 11:
1
print_endline "Hello, World!"
view (1 line, 1 line of output)
pasted on Aug 18:
1
print_string "Hello, world"
view (1 line, 1 line of output)


PHP:
pasted on Dec 5:
1
<?php echo "hello world"; ?>
view (1 line, 1 line of output)
pasted on Dec 4:
1
<?php echo "hello world"; ?>
view (1 line, 1 line of output)


Perl:
pasted on Nov 14:
1
2
3
#!/usr/bin/perl

print("hello world");
view (3 lines, 1 line of output)
pasted on Nov 14:
1
2
3
#!/usr/bin/perl

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


Python:
pasted 3 hours ago:
1
print("Hello World!")
view (1 line, 1 line of output)
pasted 3 hours ago:
1
print("Hello World!")
view (1 line, 1 line of output)


Ruby:
pasted on Dec 7:
1
print "Hello World!"
view (1 line, 1 line of output)
pasted on Dec 1:
1
puts "hello world!"
view (1 line, 1 line of output)


Scheme:
pasted on Nov 5:
1
(display "Hello, World!")
view (1 line, 1 line of output)
pasted on Oct 11:
1
2
3
(begin
  (display "Hello, World!")
  (newline))
view (3 lines, 1 line of output)