Things are getting quiet around the shop, seems like all the coding is done in foreign lands. Any way, let's get a thread started, a multilingual coding spree showing how to display "Hello World! (computer language used)". The code has to be a full program! Make sure you have the console wait to display the result too, and give us a comment.

Thanks to Dark Omen:

puts "Hello World! (ruby)"
gets  # make display wait
import msvcrt
print "Hello World! (python)"
msvcrt.getch()  # make display wait, kind of akward, does anybody know a short version?
#include <stdio.
int main()
  puts("Hello World! (C)");
  getchar();  // make display wait
  return 0;
PRINT "Hello World! (basic)"
PAUSE  ' make display wait, this may not be the best

Up to 2500 computer laguages out there! Okay, you Fortran, Lisp and Cobol folks let's have some fun ...

Recommended Answers

All 90 Replies


#include <iostream>

int main()
  std::cout<<"Hello, world!"<<std::endl;


puts(1, "Hello, world!\n")


: HELLO  ." Hello, world!" CR ;


class hello {
  public static void main(String [] args)
    System.out.println("Hello, world!");


using System;

class hello {
  public static void main()
    Console.writeln("Hello, world!");


print "Hello, world!\n";

Bored now, I may add more later.

DOS Batch files (and Windows Command prompt files):

echo Hello World!

The C++ compiler itself (well, SOME compilers like VC):

#pragma message( "Hello, World!" )

Okay, we are slowly rolling ...


Hello World! (HTML)


I simply took this from the DaniWeb snippets ...

<? echo("Hello World! (PHP)"); ?>

Do I have to find my old copy of Turbo Pascal? Pascal coders enlighten me ...

Member Avatar for Siersan
program pascal;
  writeln('Hello, world!');
// a very simple win GUI application 
#include <windows.h>

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
  MessageBox(NULL, "Hello World! (C/C++ GUI)", NULL);
  return 0;

Where are the TCL, Snobol, Smalltalk, Prolog, Scheme, Eiffel, Lisp, Cobol and Haskell coders?

unit HelloWorldz;


  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

  TForm1 = class(TForm)
    Label1: TLabel;
    procedure FormCreate(Sender: TObject);

  Form1: TForm1;


{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
  // the only 2 lines written by the coder
  Label1.Caption := 'Hello World! (Delphi WinGui)';


VBers gimme a WinGui!!

Looks like formatting asm code isn't liked very well. Anyway this is my two bits worth and I've enclosed the executable as a ZIP. Just rename HW.ZIP as HW.EXE and it will work fine.

Is anyone interested in modifying this app so "Hello World", shows as 3D text inside a box only when the left button is being pressed, centered around the cursor and staying inside main window.

I haven't included the file as mine is 2300 lines long, so if you attempt to compile you'll just have to supply the required equates, or contact me and I can send you the associated INC file.

Even though this is NOT in PHP code, It does a little better job of displaying than code tags do. :(

extern _GetMessageA@16, _TranslateMessage@4, _DispatchMessageA@4, _ExitProcess@4
extern _PostQuitMessage@4, _LoadCursorA@8, _RegisterClassExA@4, _GetModuleHandleA@4
extern _GetClientRect@8, _BeginPaint@8, _EndPaint@8, _SetBkMode@8
extern _GetStockObject@4, _InflateRect@12, _GetDC@4, _SelectObject@8
extern _TextOutA@20, _GetCommandLineA@0, _DefWindowProcA@16, _CreateWindowExA@48
section .bss
; ============================================================================================
MainWnd resd 1 ; Handle of main window
WndRect resd 4 ; Applications client area
section .data
; ùùùùùùùùùùùùùùùùùùùùùù MAIN WINDOW MESSAGE MAP ùùùùùùùùùùùùùùùùùù
dd Quit_Application
dd WndCreated
dd PaintWindow
MWSize equ ($ - MWndM) / 6
; ____________________________________________________________________________________________
Wc dd 48 ; cbSize
dd MainWndProc ; Main window procedure
dd 0, 0 ; cbClsExtra & cbWndExtra
hInst dd 0 ; Instance Handle
dd 0 ; hIcon
dd 0 ; hCursor
dd 0 ; Hmenu
dd AppName ; Applications name
dd 0 ; Small Icon 
; ____________________________________________________________________________________________
AppTitle db 'NASM by Tight_Coder_Ex', 0
AppName db 'HW', 0
PromptStr db 'H E L L O	 W O R L D', 0
STRSIZE equ $ - PromptStr - 1
; ____________________________________________________________________________________________
Cw dd EX_STYLE ; dwExStyle
dd AppName ; lpClassName
dd AppTitle ; lpWindowName
dd STYLE ; dwStyle
dd 420 ; nWidth
dd 128 ; nHeight
dd 0 ; hWndParent
dd 0 ; hMenu
dd 0 ; hInstance
dd 0 ; lpParam
section .text
; ============================================================================================ 
; 		*** CREATE_WND ***
; ENTRY: EBX = Pointer to structure CreateWindowEx structure
; LEAVE: EAX = Handle to window, or null if failed
; CY = 0 Successful, 1 otherwise.
; --------------------------------------------------------------------------------------------
Create_Wnd mov ecx, 48
sub esp, ecx ; Create stack frame for CreateWindowEx
mov edx, esp ; Need this pointer in EDI
push esi
push edi ; Save registers
mov edi, edx
mov esi, ebx ; Setup for movsd
shr ecx, 2 ; Number of dwords to move
rep movsd ; Copy parameters into stack area
pop edi
pop esi ; Restore index registers and create
call _CreateWindowExA@48 ; window
and eax, eax
jnz .Done + 1 ; If non zero, then was successful
; Error handling code will eventually go here
.Done stc	; Set error flag
; ============================================================================================
; 		 *** MESSAGE HANDLER ***
; This procedure determines if application has a handler for a particular event. All windows
; procedures are passed to this subroutine except those that have been sub or super classed.
; ENTRY: ESI = Pointer to message map
; ECX = Number of sets in map.
; Each set consists of a 16 bit ID and 32 bit pointer to proceedure.
; LEAVE: EAX = 0 if application handled event, or result of DefWindowProc is not.
; --------------------------------------------------------------------------------------------
; ESP + 0 = Return address in kernel module
; ESP + 4 = hWnd, this windows 32 bit handle
; ESP + 8 = Msg, Message ID passed by OS.
; ESP + 12 = wParam
; ESP + 16 = lParam
MsgHandler mov edx, [esp + 8] ; Get message ID 0 - 1024 or user defined.
; In the unlikely event a null map is passed to this routine, this method of
; testing ECX first will prevent a fatal crash.
.NextMsg and ecx, ecx ; Are we at the end yet
jz .Default ; ZR = 1, If we are to do default proceesing.
dec ecx ; Decrement counter
lodsw ; Get 16 bit ID from message map
cmp ax, dx ; Is there a match
lodsd ; Load pointer
jnz .NextMsg
; At this point we've found a match and as many events need wParam & lParam,
; I'm going to establish a pointer to those in EBX. hWnd can be simply addressed
; by EBX - 8 or lParam by EBX + 4.
lea ebx, [esp + 12] ; EBX points to wParam
call eax ; Execute event
jnc .Default ; CY = 0, if event requires default proc.
xor eax, eax ; Application handled need to return null.
ret 16 ; Stack needs to be re-aligned.
; As hWnd, Msg, wParam & lParam are already on the stack I use this method
; as a trace into kernel showed OS handles this appropriately and there is no
; point pushing onto stack what is already there. I've tested this on 98/ME/XP.
.Default pop ebx
call _DefWindowProcA@16
jmp ebx
; You'll notice at this point we don't need RET 16 as the call to DefWindowProc has already
; done that for us. 
section .code
; ============================================================================================
; This is where application begins after OS has done its thing. I use the space before
; ShowMainWnd for anything that is not particularly related to displaying main window or is
; coded into a message handler such as WM_CREATE.
; --------------------------------------------------------------------------------------------
global Main
Main enter 28, 0 ; MSG structure in proceedure frame.
; In the event there is a failure creating main window, MSG.wParam has already been
; established. If a different value is required, set it where ever required.
lea ebx, [ebp - 28] ; EBX points to MSG
dec dword [ebx + 8] ; Msg.wParam = -1, default error condition.
call ShowMainWnd ; Display window and do other initialization.
jc .Exit ; NC = 1, Proeedure failed. 
xor eax, eax ; EAX = NULL
; Applications message pump, continually scan for messages until WM_QUIT is returned.
.Pump push eax ; Save zero value in EAX
push eax ; wMsgFilterMax
push eax ; wMsgFilterMin
push eax ; hWnd = 0, Desktop
push ebx ; Pointer to MSG
call _GetMessageA@16
and eax, eax ; Evaluate returned value
jz .Exit ; ZR = 1, WM_QUIT in message que.
; If main window is a dialog box, IsDialog would be evaluated here.
push ebx
call _TranslateMessage@4
push ebx
call _DispatchMessageA@4
pop eax ; Restore NULL
jmp short .Pump
; Application has terminated, either because ShowMainWnd failed or message que
; encountered WM_QUIT. Other fatal errors usually kill app at the point they
; were encountered as ExitProcess will do appropriate cleanup anywhere.
.Exit leave
push dword [ebx + 8] ; MSG.wParam
call _ExitProcess@4 ; Cleanup
; ============================================================================================
;		 *** SHOW MAIN WINDOW ***
; As the name implies the only responsiblity of this section of code is to register and 
; display main window. 
; LEAVE: CY = 1, If either registering class or creating window failed. Additional
;	code could be added to further define which caused the error.
; --------------------------------------------------------------------------------------------
ShowMainWnd push ebx
mov ebx, Wc ; Point to WNDCLASSEX structure in .data
push IDC_ARROW ; Establish main windows cursor
push byte 0
call _LoadCursorA@8
mov [ebx + 0x1c], eax ; hCursor
push byte 0
call _GetModuleHandleA@4
mov [hInst], eax
push eax
; Now that everything has been initialized the window class can be registered.
push ebx
call _RegisterClassExA@4
and eax, eax ; Set flags
jz .Exit ; EAX = 0 then registration failed. 
; Create applications main window
mov ebx, Cw
pop eax 
mov [ebx + 40], eax
call Create_Wnd
mov [MainWnd], eax ; Save hWnd
jnc .Exit + 1
.Exit stc
pop ebx
; ============================================================================================
; Officially terminates application after user or some other method closes main window.
; --------------------------------------------------------------------------------------------
push byte 0
call _PostQuitMessage@4 ; Sends quit message to window
stc	; set so no default processing
align 16
; ============================================================================================
; Windows message handlers
; ENTRY: No registers are passed, windows calls this routine
; LEAVE: ESI = Points to message map
; ECX = Number of messages
; NOTE: As windows calls this procedure we want to make sure all registers except
; eax, ecx, edx are preserved. 
; -------------------------------------------------------------------------------------------- 
mov esi, MWndM ; Point to windows class structure
mov ecx, MWSize ; Number of messages in list 
jmp MsgHandler
align 16
; ============================================================================================
; 			*** WINDOW CREATED ***
; We need these sizes everytime the right mouse button is pressed, so it might as well be done
; once here.
; -------------------------------------------------------------------------------------------- 
; Determine size of applications client area.
mov edi, WndRect
push edi
mov esi, [ebx - 8] ; hWnd
push esi
call _GetClientRect@8
; Inflate to give a 16 pixel margin around the inside. This determines the what 
; could be termed the display frames clipping region.
sub eax, 17 ; Little dangerous to assume value of EAX
push eax ; just to save two bytes of code.
push eax
push edi
call _InflateRect@12
; The GetStockObject function retrieves a handle to one of the predefined stock pens,
; brushes, fonts, or palettes. 
push byte DEFAULT_GUI_FONT ; System defined PEN
call _GetStockObject@4
push eax ; 2nd parameter for SelectObject call
; The GetDC function retrieves a handle to a display device context for the
; client area of a specified window or for the entire screen. You can use the
; returned handle in subsequent GDI functions to draw in the device context. 
push esi
call _GetDC@4
push eax ; 1st parameter for SelectObject
; The SetBkMode function sets the background mix mode of the specified device
; context. The background mix mode is used with text, hatched brushes, and pen
; styles that are not solid lines. 
push eax
call _SetBkMode@8
; The SelectObject function selects an object into the specified device context.
; The new object replaces the previous object of the same type. 
call _SelectObject@8
; ============================================================================================
; 	 *** PAINT EVENT ***
; The static window needs to indicate to user what he/she should do. This event looks after
; displaying that 3D message.
; -------------------------------------------------------------------------------------------- 
enter 64, 0 ; PAINTSTRUCT
lea esi, [ebp - 64]
; BeginPaint function prepares the specified window for painting and fills a
; PAINTSTRUCT structure with information about the painting. 
push esi ; PAINTSTRUCT
push dword [ebx - 8] ; hWnd
call _BeginPaint@8
push byte STRSIZE
push dword PromptStr
push byte 22
push byte 32
push eax
call _TextOutA@20
; EndPaint function marks the end of painting in the specified window.
; This function is required for each call to the BeginPaint function, but only after
; painting is complete. 
push esi ; PAINTSTRUCT
push dword [ebx - 8] ; hWnd
call _EndPaint@8

One more, still need to arouse the LISP folks ...

  document.write("Hello World! (JavaSript)");



Tight_Coder_Ex wonderful asm code, would be nice to see the console code just to look at the difference ...

Pulled this example from the net. This is a fullblown Windows GUI program to say "Hello World!" ...

# Hello World using Python 2.3 and wxPython 2.5

import wx

def create(parent):
    return Frame1(parent)

[wxID_FRAME1, wxID_FRAME1STATICTEXT1] = [wx.NewId() for _init_ctrls in range(2)]

class Frame1(wx.Frame):
    def _init_ctrls(self, prnt):
        wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
              pos=wx.Point(326, 167), size=wx.Size(523, 173),
              style=wx.DEFAULT_FRAME_STYLE, title='Show it off!')
        self.SetClientSize(wx.Size(515, 133))

        self.staticText1 = wx.StaticText(id=wxID_FRAME1STATICTEXT1,
              label=' Hallo World!', name='staticText1', parent=self,
              pos=wx.Point(0, 0), size=wx.Size(515, 133), style=0)
        self.staticText1.SetFont(wx.Font(48, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'Comic Sans MS'))
        self.staticText1.SetForegroundColour(wx.Colour(255, 255, 0))
        self.staticText1.SetBackgroundColour(wx.Colour(0, 128, 64))

    def __init__(self, parent):

if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = create(None)


Here is "Hello World!" using tcl scripting:

label .label -text "Hello World! in tcl script"
pack .label

Did you know Python can run tcl script easily?

# Python23

import Tkinter

root = Tkinter.Tk()
tclScript = """
    # here is a tcl script
    label .label -text "Hello World! in tcl script"
    pack .label
"""'eval', tclScript)

How come no one did python??

How come no one did python??

Be my guest!

Here is a rare one:

main( ) 
  putchar('Hello World! in B language, the one that came before C');

Hmm! You and Dave must veritably know how to google! I am dazzled.

Well here is a real oldy ...

DATA DIVISION.             
Display 'Hello World! in COBOL'.

From a very shy Lisp person ...

(write-line "Hello World! in Common-Lisp")

A visit back to the early days of programming ...

; Hello World for Intel Assembler (MSDOS)
mov ax,cs
mov ds,ax
mov ah,9
mov dx, offset Hello
int 21h
xor ax,ax
int 21h

  db "Hello World! in Intel asm",13,10,"$"

Contribution from Bud Tugly, a guy who still writes Fortran programs ...

PRINT*, 'Hello World! in Fortran77'

From Brazil comes the interesting language Lua
(Portuguese for moon). I am having fun with Lua!

io.write("Hello World! using Lua 5.0")
-- or
print("Hello World!")

Why not try a scripting language like ColdFusion?

  WriteOutput("Hello World! in ColdFusion script");

Can this be true?

import std.c.stdio;
void main()
  printf("Hello, World! in D language");

From one of the many Schemers ...

(define hello 
  (lambda ()
    (display "Hello World! in Scheme")))

Belatedly a contribution from the Senior Home:

10 REM Hello World in MBASIC
20 PRINT "Hello World! in MBASIC"


print "Hello World!"

I'm a failure xD

What does the B in Basic stand for?
Here is Haskell, something the profs can use to bother the grads!

module Hello
main = do putStrLn "Hello World! written in Haskell"

>What does the B in Basic stand for?
Beginner's All-purpose Symbolic Instruction Code

>What does the B in Basic stand for?
Beginner's All-purpose Symbolic Instruction Code

Thanks Narue, need to get a Hello World in Tama from you!

I never figured out that tama thing

>need to get a Hello World in Tama from you!

"Hello, world!" @W0 @NL

>I never figured out that tama thing
Let me know what you're having trouble with. It'll help with the design.


{ This is program Hello World, written for DaniWeb on March 21, 2001 }
  { This PASCAL program demonstrates the fine use of comments in an }
  { ancient tradition of writing more comments needed, just to prove a }
  { point. }
  { Let's Begin }
  program HELLODER;
       WRITELN('Hello World.');

I miss PASCAL.

This will date me, but I bought Turbo Pascal v.1.0 for $49.95 from a computer magazine advertisement. A neat program in those days, the first IDE I ever experienced. Later I got hooked on Delphi ...

  WriteLn('Hello World! in Delphi console mode');

Narue, do I see a little bit of Clipper in Tama script?

>Narue, do I see a little bit of Clipper in Tama script?
Partial inspiration from Forth, partial from a post here concerning a toy language called Magic Lite, and the rest from my twisted mind.

Well I downloaded tama and like nothing happened i tried running it and stuff and nothing happened

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.