[ create a new paste ] login | about

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

C:
pasted yesterday:
1
2
3
4
5
6
7
8
#include<stdio.h>

int main(){
int year;
year = 2021;
printf("HELLO, WORLD!", year);
return 0;
}
view (8 lines, 1 line of output)
pasted yesterday:
1
2
3
4
5
6
7
8
#include<stdio.h>

int main(){
int year;
year = 2021;
printf("HELLO, WORLD!\n", year);
return 0;
}
view (8 lines, 1 line of output)


C++:
pasted 6 minutes ago:
1
2
3
4
5
6
#include <iostream>

int main()
{
    std::cout << "Hello World" << std::endl;
}
view (6 lines, 1 line of output)
pasted yesterday:
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 Aug 15:
1
main = putStrLn "Hello, World"
view (1 line, 1 line of output)
pasted on Aug 15:
1
main = putStrLn "Hello, World"
view (1 line, 1 line of output)


Lua:
pasted on Sep 9:
1
print("hello world!")
view (1 line, 1 line of output)
pasted on Sep 8:
1
print("hello world")
view (1 line, 1 line of output)


PHP:
pasted on Sep 20:
1
2
3
<?php
    echo "Hello, world!";
?>
view (3 lines, 1 line of output)
pasted on Sep 17:
1
hello, world
view (1 line, 1 line of output)


Perl:
pasted on Aug 15:
1
print "Hello world!";
view (1 line, 1 line of output)


Python:
pasted 5 hours ago:
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 Sep 14:
1
puts "hello world"
view (1 line, 1 line of output)
pasted on Sep 7:
1
puts('Hello World')
view (1 line, 1 line of output)


Scheme:
pasted on Aug 10:
1
(display "Hello world!")
view (1 line, 1 line of output)
pasted on Jul 29:
1
(display "Hello world!")
view (1 line, 1 line of output)