How To Wiki
Advertisement

The following shows a Hello World program in many different languages. A Hello World program is supposedly the simplest program possible in any language.


A[]

B[]

BASIC

PRINT"Hello, World!"



+++++ +++++             initialize counter (cell #0) to 10
[                       use loop to set the next four cells to 70/100/30/10
   > +++++ ++              add  7 to cell #1
   > +++++ +++++           add 10 to cell #2 
   > +++                   add  3 to cell #3
   > +                     add  1 to cell #4
   <<<< -                  decrement counter (cell #0)
]                   
> ++ .                  print 'H'
> + .                   print 'e'
+++++ ++ .              print 'l'
.                       print 'l'
+++ .                   print 'o'
> ++ .                  print ' '
<< +++++ +++++ +++++ .  print 'W'
> .                     print 'o'
+++ .                   print 'r'
----- - .               print 'l'
----- --- .             print 'd'
> + .                   print '!'

or simply:

++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.

C[]

C

#include <stdio.h>
#include <conio.h>

void main(){
   printf("Hello, World!");
   getch();
}


C++

#include <iostream>
#include <conio.h>
using namespace std;

void main(){
   cout<<"Hello, World!";
   _getch();
}


C#

using System;

class Program
{
   public static void Main()
   {
      Console.WriteLine("Hello, World!");
      Console.ReadKey();
   }
}

D[]

D

import std.stdio;

void main()
{
   writeln("Hello, World!");
}

E[]

F[]

G[]

H[]

HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hi!</title>
</head>
<body>
<p>Hello, World!</p>
</body>
</html>

I[]

J[]

Java

In console:

public class HelloWorld {
   public static void main(String[] args) {
      System.out.println("Hello, World!");
      System.in.read()
   }
}

or in window with Swing:

import javax.swing.JFrame;  //Importing class JFrame
import javax.swing.JLabel;  //Importing class JLabel
public class HelloWorld {
   public static void main(String[] args) {
      JFrame frame = new JFrame();           //Creating frame
      frame.setTitle("Hi!");                 //Setting title frame
      frame.add(new JLabel("Hello, World!"));//Adding text to frame
      frame.pack();                          //Setting size to smallest
      frame.setLocationRelativeTo(null);     //Centering frame
      frame.setVisible(true);                //Showing frame
   }
}

or in dialog:

import javax.swing.JOptionPane;
public class HelloWorld {
   public static void main(String[] args) {
      javax.swing.JOptionPane.showMessageDialog(null, "Hello, World!");
   }
}


Javascript

function myFunction()
{
document.write("Hello, World!");
}

K[]

L[]

LOLCODE

HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE

M[]

N[]

O[]

P[]

Perl

#!/usr/bin/perl
use strict;
use warnings;
print "Hello, World!\n";
<STDIN>;


PHP

<html>
   <head>
      <title>PHP Test</title>
   </head>
   <body>
      <?php echo '<p>Hello, World!</p>'; ?> 
   </body>
</html>


Python

import msvcrt as m
print("Hello, World!")
def wait():
    m.getch()

Q[]

R[]

Ruby

puts "Hello, World"

S[]

SimpleC

OUT<"Hello, World!"
SLP[BUT[16]]
STOP


SmileBASIC

PRINT "Hello, World!"
'or in compacted code
'?"Hello, World!
@ENDLOOP
IF !(BUTTON() AND 16) THEN GOTO @ENDLOOP
'or in compacted code
'IF!(BUTTON()AND 16)GOTO@ENDLOOP
'or
'FOR I=0TO 1STEP 0:IF (BUTTON()AND 16)THEN I=1ELSE NEXT

T[]

THOLITU

#IMPORT <{stdcl}>
-<{Hello, World!}
!O{}>B@16
>|

U[]

V[]

W[]

Witeal

@               introduce program
+-.             clear character stack
,,,,,.          add 4 to stored number stack (for convenience)
+/,/,,.         add 'H' to stored stack
+/,,.           add 'E' to stored stack
+/,/,/,.        add 'L' to stored stack
+/,/,/,.        add 'L' to stored stack
+/,/,/,,,,.     add 'O' to stored stack
+.              add ' ' to stored stack
+/,/,/,/,/,,,,. add 'W' to stored stack
+/,/,/,,,,.     add 'O' to stored stack
+/,/,/,/,,,.    add 'R' to stored stack
+/,/,/,.        add 'L' to stored stack
+/,.            add 'D' to stored stack
/+.             display stack "HELLO WORLD"
[               initialize infinite loop
]               continue infinite loop
_               declare end of program

or simply:

@+-.,,,,,.+/,/,,.+/,,.+/,/,/,.+/,/,/,.+/,/,/,,,,.+.+/,/,/,/,/,,,,.+/,/,/,,,,.+/,/,/,/,,,.+/,./+.[]_

X[]

Y[]

Z[]

Advertisement