Tuesday, September 28, 2010

All Programming Languages-Hello World! 2


Objective C

[edit]Procedural C Version

#import    int main (int argc, const char *argv[]) {     printf ("Hello, world!\n");     return 0; } 

[edit]Object-Oriented C Version

#import  #import     @interface Hello : Object { } - hello; @end    @implementation Hello - hello {    printf("Hello, world!\n"); } @end    int main(void) {    id obj;    obj = [Hello new];    [obj hello];    [obj free];    return 0; } 

[edit]OPENSTEP/Cocoa Version

#import    int main (int argc, const char * argv[]) {    NSLog(@"Hello, world!");    return 0; } 


print_endline "Hello, world!" ;; 


#USE "course.lib"  PROC hello.world(CHAN OF BYTE screen!)   out.string("Hello, world!*n", 0, screen!) : 

or without using course.lib

PROC hello.world(CHAN OF BYTE screen!)   SEQ     screen ! 'H'     screen ! 'e'     screen ! 'l'     screen ! 'l'     screen ! 'o'     screen ! ','     screen ! ' '     screen ! 'w'     screen ! 'o'     screen ! 'r'     screen ! 'l'     screen ! 'd'     screen ! '!'     screen ! '*n' : 


See also GUI section.

PROC hello:   PRINT "Hello, world!" ENDP 


(object-class request          ^action)  (startup    (strategy MEA)    (make request ^action hello) )  (rule hello    (request ^action hello)    (write |Hello, world!| (crlf)) ) 


module hello (main) {  procedure main( )    {       write() |Hello, world!|, '\n';    }; }; 

[edit]Oz programming language

{Browse 'Hello, world!'} 

[edit]Parrot assembly language

print "Hello, world!\n" end 

[edit]Parrot intermediate representation

.sub hello :main   print "Hello, world!!\n" .end 


main() {     print("Hello World"); } 


program hello; Uses Wincrt; begin   Writeln('Hello, world!'); Readkey; end. 


 print "Hello, world!\n"; 

(This is the first example in Learning Perl; the semicolon is optional.)


 package Hello;  sub new() { bless {} }  sub Hello() { print "Hello, world! \n" }  package main;  my $hello = new Hello;  $hello->Hello(); 

[edit]Perl 6

 "Hello, world!".say 


 say "Hello, world!"; 


 print "Hello, world!\n"; 


   echo "Hello, world!";  ?> 


   print "Hello, world!";  ?> 

or if short open tags are enabled

"Hello, world!"?> 


int main() {     write("Hello, world!\n");     return 0; } 


T:Hello, world! 


set serveroutput on size 1000000;  -- this is a SQL*Plus command to enable the output buffer begin     dbms_output.put_line('Hello, world!');  end; 


Test: proc options(main);   put list('Hello, world!'); end Test; 


'Hello, world!' => 


(Hello, world!\n) print 


println("Hello, world!"); 

[edit]Progress 4GL

message "Hello, world!" view-as alert-box. 


:- write('Hello, world!'),nl. 

[edit]Pure Data

#N canvas 0 0 300 300 10; #X obj 100 100 loadbang; #X msg 100 150 Hello, world!; #X obj 100 200 print; #X connect 0 0 1 0; #X connect 1 0 2 0; 


'Hello, World!' (with quotation marks) can be attained through:

'Hello, world!' 

Two easter eggs (Python 2.0):

import __hello__   import __phello__ 

Prior to Python 3.0:

print "Hello, world!" 

Python 3.0 or later:

print("Hello, world!") 

or any Python version

import sys sys.stdout.write("Hello, world!") 


See also GUI section.

print "Hello, world!" 


; Should work with any MARS >= ICWS-86 ; with 128x64 gfx core Start MOV 0,2455       MOV 0,2458       MOV 0,2459       MOV 0,2459       MOV 0,2459       MOV 0,2459       MOV 0,2459       MOV 0,2460       MOV 0,2465       MOV 0,2471       MOV 0,2471       MOV 0,2471       MOV 0,2479       MOV 0,2482       MOV 0,2484       MOV 0,2484       MOV 0,2484       MOV 0,2486       MOV 0,2486       MOV 0,2486       MOV 0,2486       MOV 0,2488       MOV 0,2493       MOV 0,2493       MOV 0,2493       MOV 0,2493       MOV 0,2497       MOV 0,2556       MOV 0,2559       MOV 0,2560       MOV 0,2565       MOV 0,2570       MOV 0,2575       MOV 0,2578       MOV 0,2585       MOV 0,2588       MOV 0,2589       MOV 0,2592       MOV 0,2593       MOV 0,2596       MOV 0,2597       MOV 0,2603       MOV 0,2605       MOV 0,2608       MOV 0,2667       MOV 0,2670       MOV 0,2671       MOV 0,2676       MOV 0,2681       MOV 0,2686       MOV 0,2689       MOV 0,2696       MOV 0,2699       MOV 0,2700       MOV 0,2703       MOV 0,2704       MOV 0,2707       MOV 0,2708       MOV 0,2714       MOV 0,2716       MOV 0,2719       MOV 0,2778       MOV 0,2778       MOV 0,2778       MOV 0,2778       MOV 0,2778       MOV 0,2779       MOV 0,2779       MOV 0,2779       MOV 0,2782       MOV 0,2787       MOV 0,2792       MOV 0,2795       MOV 0,2802       MOV 0,2805       MOV 0,2806       MOV 0,2809       MOV 0,2810       MOV 0,2810       MOV 0,2810       MOV 0,2810       MOV 0,2812       MOV 0,2818       MOV 0,2820       MOV 0,2823       MOV 0,2882       MOV 0,2885       MOV 0,2886       MOV 0,2891       MOV 0,2896       MOV 0,2901       MOV 0,2904       MOV 0,2911       MOV 0,2912       MOV 0,2913       MOV 0,2914       MOV 0,2917       MOV 0,2918       MOV 0,2919       MOV 0,2922       MOV 0,2928       MOV 0,2930       MOV 0,2933       MOV 0,2992       MOV 0,2995       MOV 0,2996       MOV 0,3001       MOV 0,3006       MOV 0,3011       MOV 0,3014       MOV 0,3021       MOV 0,3022       MOV 0,3023       MOV 0,3024       MOV 0,3027       MOV 0,3028       MOV 0,3030       MOV 0,3032       MOV 0,3038       MOV 0,3040       MOV 0,3103       MOV 0,3106       MOV 0,3107       MOV 0,3107       MOV 0,3107       MOV 0,3107       MOV 0,3107       MOV 0,3108       MOV 0,3108       MOV 0,3108       MOV 0,3108       MOV 0,3108       MOV 0,3109       MOV 0,3109       MOV 0,3109       MOV 0,3109       MOV 0,3109       MOV 0,3111       MOV 0,3111       MOV 0,3111       MOV 0,3120       MOV 0,3121       MOV 0,3124       MOV 0,3124       MOV 0,3124       MOV 0,3126       MOV 0,3129       MOV 0,3130       MOV 0,3130       MOV 0,3130       MOV 0,3130       MOV 0,3130       MOV 0,3131       MOV 0,3131       MOV 0,3131       MOV 0,3131       MOV 0,3135       JMP 0 

Redcode HelloWorld running on a MARS


$ENTRY GO{=;} 

[edit]REXX, ARexx, NetRexx, and Object REXX

/* a starting comment is needed in mainframe versions */ say "Hello, world!" 


[edit]Free-Form Syntax

/FREE      DSPLY 'Hello, world!';      *InLR = *On;  /END-FREE  

[edit]Traditional Syntax

With this syntax, a constant has to be used because the message must be placed in positions 12 to 25, between apostrophes.

     d TestMessage     c                   Const( 'Hello, world!' )       c     TestMessage   DSPLY       c                   EVAL      *InLR = *On 

[edit]RPG Code

[edit]Message Window

Using the internal message window, a simple Hello, world! program can be rendered thus:

mwin("Hello, world!") wait() 

[edit]On Screen Text

An additional way to render text is by using the built in text() function.

text(1,1,"Hello, world!") wait() 


See also GUI section.

(On Hewlett-Packard HP-28, HP-48 and HP-49 series graphing calculators.)


[edit]RT Assembler

       _name   Hello~World!        pause   Hello~World!        exit        _end 


See also GUI section.

 puts 'Hello, world!' 


 'Hello, world!'.each { |s| print s } 


 class String      def say          puts self      end  end  'Hello, world!'.say 

[edit]S (and R)

print("Hello, world") 


message("Hello, world") 


message("Hello, world!"); 


data _null_; put 'Hello, world!'; run; 


class HELLO_WORLD is   main is     #OUT+"Hello, world!\n";    end;  end; 


object HelloWorld extends Application {   println("Hello, world!") } 


program HelloWorld; begin  WriteLn('Hello world!'); end. 


(note: requires at least one line of input)

sed -ne '1s/.*/Hello, world!/p' 


$ include "seed7_05.s7i";  const proc: main is func   begin     writeln("Hello, world!");   end func; 


'Hello, world!' print. 

[edit]sense script

out('Hello, world!'); 


'set up initial variables struct.follow  {   cpu.fan.speed(500.rpm)   cpu.max.process(100)  } <> 'open and write the text in a free handle window open mainwin(io) as free(1)  {   write.free(1).("Hello",&sym," world",&sym)(&sym<",">&sym<"!">   apply.free(1) to text  } 'reset the fan, cpu, and vars <> 'end end .end/ 


BEGIN     OutText("Hello, world!");     OutImage; END 


Transcript show: 'Hello, world!' 


StdoutStream nextPutLine: 'Hello, world' 


print "Hello, world!\n"; 


    OUTPUT = "Hello, world!" END 


class Hello {   static public main: args {     Console << "Hello, world!\n";   } } 


with Spark_IO; --# inherit Spark_IO; --# main_program;  procedure Hello_World --# global in out Spark_IO.Outputs; --# derives Spark_IO.Outputs from Spark_IO.Outputs; is begin   Spark_IO.Put_Line (Spark_IO.Standard_Output, "Hello, world!", 0); end Hello_World; 


    OUTPUT = "Hello, world!" END 


1.0 print Hello, World! end 

[edit]SPSS Syntax

ECHO "Hello, world!". 


CREATE TABLE message (text char(15)); INSERT INTO message (text) VALUES ('Hello, world!'); SELECT text FROM message; DROP TABLE message; 

or (for EnterpriseDB's Stored Procedure Language (SPL))

BEGIN     DBMS_OUTPUT.PUT_LINE('Hello, world!'); END; 

or (e.g. Oracle dialect)

SELECT 'Hello, world!' FROM dual; 

or (for Oracle's PL/SQL proprietary procedural language)


or (e.g. MySQL or PostgreSQL dialect)

SELECT 'Hello, world!'; 

or (for PostgreSQL's PL/pgSQL Procedural language)

CREATE FUNCTION hello_world() RETURNS text AS $$   BEGIN      RETURN 'Hello, world!';   END $$ LANGUAGE plpgsql; 

or (e.g. T-SQL dialect)

PRINT 'Hello, world!' 

or (for KB-SQL dialect)

FOOTER or HEADER or DETAIL or FINAL event write "Hello, world!" 


RACINE: HELLO_WORLD.  NOTIONS: HELLO_WORLD : ecrire("Hello, world!"). 


Define program in script (.do-file) or at command line:

   capture program drop hello /*Define Hello, world! program*/    program define hello            di "Hello, world!"    end     hello  /*run Hello, world! program*/ 

Or, interactively at the command line:

   di "Hello, world!" 


"Hello, world!".postln; 

or, for interactive prompt,

"Hello, world!" 


#OUTPUT Hello, world! 

[edit]Tcl (Tool command language)

See also GUI section.

puts "Hello, world!" 

[edit]Template Toolkit

[% GET "Hola mundo!"; %] 

[edit]TOM (rewriting language)

public class HelloWorld {  %include { string.tom }  public final static void main(String[] args) {    String who = "world";    %match(String who) {      "World" -> { System.out.println("Hello, " + who + "!"); }      _       -> { System.out.println("Don't panic"); }    }  } 


put "Hello, world!" 


Declare @Output varchar(16) Set @Output='Hello, world!' Select 'Output' = @Output 

or, simpler variations:

Select 'Hello, world!' Print 'Hello, world!' 


module hello_world {   control {     log("Hello, world!");   } } 

[edit]UNIX-style shell

echo 'Hello, world!' 

or using an inline 'here document'

cat <<'DELIM' Hello, world! DELIM 


printf '%s' $'Hello, world!\n' 

or for a curses interface:

dialog --msgbox 'Hello, world!' 0 0 


using GLib;   public int main(string[] args) {        stdout.printf("Hello, world!\n");        return 0; } 


module main();        initial begin               #0 $display("Hello, world!!");               #1 $finish;        end endmodule 

or (a little more complicated)

module hello(clk);        input clk;        always @(posedge clk) $display("Hello, world!!"); endmodule module main();        reg     clk;        hello H1(clk);        initial begin               #0 clk=0;               #5 clk=1;               #1 $finish;        end endmodule 
module hello(clk);        input clk;        always @(posedge clk) $display("Hello, world!!"); endmodule module main();        reg     clk;        hello H1(clk);        initial begin               #0 clk=0;               #23 $display("--23--");               #100 $finish;        end        always #5 clk=~clk; endmodule 


use std.textio.all;  entity Hello is end Hello;  architecture Hello_Arch of Hello is begin        p : process        variable l:line;        begin                write(l, String'("Hello, world!"));                writeline(output, l);                wait;        end process; end Hello_Arch; 

[edit]Visual Basic Script

WScript.Echo "Hello, world!" 

See also additional examples.

[edit]Visual Prolog

#include @"pfc\console\console.ph"  goal   console::init(),   stdio::write("Hello, world!"). 

[edit]Windows PowerShell

    "Hello, world!" 


   Write-Host "Hello, world!" 


   echo "Hello, world!" 


   [System.Console]::WriteLine("Hello, world!") 


   [void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')    [System.Windows.Forms.MessageBox]::Show("Hello, World!") 


   use XL.UI.CONSOLE    WriteLn "Hello, world!" 


   import IO = XL.UI.CONSOLE    IO.WriteLn "Hello, world!" 


   XMLmosaic Class        Main     void Main() { Console.WriteLine('Hello World!'); }                1     


write, "Hello, world!"; 

Note: The semicolon is optional.

[edit]Graphical user interfaces (GUIs)

[edit]ActionScript (Macromedia flash mx)

this.createTextField("hello_txt",0,10,10,100,20); this.hello_txt.text="Hello, world!"; 


See also TUI section.

display dialog "Hello, world!" buttons {"OK"} default button 1 


See also TUI section.

import System.Drawing import System.Windows.Forms f = Form() f.Controls.Add(Label(Text: "Hello, world!", Location: Point(40,30))) f.Controls.Add(Button(Text: "Ok", Location: Point(50, 55), Click: {Application.Exit()})) Application.Run(f) 

Functional equivalent of C# program below.


See also TUI section.

Simply, using Message Box:

 public class HelloWorld  {      static void Main()      {          System.Windows.Forms.MessageBox.Show("Hello, world!");      }  } 


using System; using System.Drawing; using System.Windows.Forms;    public class HelloWorldForm : Form   {      public static void Main()       {          Application.Run(new HelloWorldForm());      }        public HelloWorldForm()       {         Label label = new Label();         label.Text = "Hello, world!";         label.Location = new Point(40,30);         this.Controls.Add(label);         Button button = new Button();         button.Text = "OK";         button.Location = new Point(50,55);         this.Controls.Add(button);         button.Click += new EventHandler(button_Click);      }        private void button_Click(Object sender, EventArgs e)       {         Application.Exit();      }  } 


The simplest way to achieve this is with the built in message function that is similar to the windows messageBox().

   PROGRAM    MAP    END    CODE    MESSAGE('Hello, world!!','Clarion')    RETURN 

A more real world example uses a Clarion structure to declare a window and the Clarion Accept loop to process events from that window.

  PROGRAM     MAP HelloProcedure  PROCEDURE()     END      CODE     HelloProcedure()     RETURN  HelloProcedure  PROCEDURE() Window WINDOW('Clarion for Windows'),AT(,,222,116),FONT('Tahoma',8,,FONT:regular),ICON('Hey.ICO'), |          SYSTEM,GRAY        STRING('Hello, world!!'),AT(91,22),USE(?String1)        BUTTON('Close'),AT(92,78,37,14),USE(?CloseBtn),LEFT      END     CODE     OPEN(Window)     ACCEPT       CASE ACCEPTED()       OF ?CloseBtn         POST(EVENT:CloseWindow)       END     END     CLOSE(Window)     RETURN 

[edit]Cocoa or GNUStep (In Objective C)

#import  @interface hello : NSObject { } @end   @implementation hello   -(void)awakeFromNib {       NSBeep(); // we don't need this but it's conventional to beep                 // when you show an alert      NSRunAlertPanel(@"Message from your Computer", @"Hello, world!", @"Hi!",                      nil, nil); }   @end 


{curl 3.0, 4.0 applet} {curl-file-attributes character-encoding = "utf-8"}  Hello, world! 

[edit]Delphi, Kylix

program Hello_World; uses       QDialogs;   begin     ShowMessage('Hello, world!');   or     MessageDlg ('Hello, world!', mtInformation, [mbOk], 0);     end. 


See also TUI section
-module(hello_world). -export([hello/0]).  hello() ->    S = gs:start(),    Win = gs:create(window, S, [{width, 100}, {height, 50}]),    gs:create(label, Win, [{label, {text, "Hello, world!"}}]),    gs:config(Win, {map, true}),    receive       {gs, Win, destroy, _, _} ->          gs:stop()    end,    ok. 

One way of invoking this would be to enter hello_world:hello(). in the Erlang shell; another would be to run from a command line:

erl -noshell -run hello_world hello -run init stop 


MS-Windows only - basic.

include msgbox.e if message_box("Hello, world!", "Hello", 0) then end if 

MS-Windows only - using Win32Lib library

include win32lib.ew createForm({        ";Window; Hello",        ";Label;  Hello, world!"    }) include w32start.ew 


Using WindowsForms, at the F# interactive prompt:

let _ = System.Windows.Forms.MessageBox.Show("Hello, world!");; 

[edit]FLTK2 (in C++)

#include  #include  #include  using namespace fltk;   int main(int argc, char **argv) {     Window *window = new Window(300, 180);     window->begin();         Widget *box = new Widget(20, 40, 260, 100, "Hello, world!");         box->box(UP_BOX);         box->labelfont(HELVETICA_BOLD_ITALIC);         box->labelsize(36);         box->labeltype(SHADOW_LABEL);      window->end();      window->show(argc, argv);       return run();  } 

[edit]G (LabVIEW)

See Labview.

TUI section.

PUBLIC SUB Main()   Message.Info("Hello, world!") END 

[edit]Gtk# (in C#)

using Gtk; using GtkSharp; using System;   class Hello {       static void Main()     {         Application.Init ();           Window window = new Window("");         window.DeleteEvent += cls_evn;         Button close  = new Button ("Hello, world!");         close.Clicked += new EventHandler(cls_evn);           window.Add(close);         window.ShowAll();           Application.Run ();       }       static void cls_evn(object obj, EventArgs args)     {         Application.Quit();     }   } 

[edit]GTK+ 2.x (in Euphoria)

include gtk2/wrapper.e  Info(NULL,"Hello","Hello, world!") 

[edit]IOC/OCL (in IBM VisualAge for C++)

#include  void main() {     IFrameWindow frame("Hello, world!");     frame.showModally() } 


See also TUI section.

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


This creates a window labeled "Hello, world!" with a button labeled "Hello, world!".

hello:hello..l:"Hello, world!" hello..c:`button `show$`hello 

[edit]LabVIEW (G)

See LabVIEW.


[edit]Microsoft Foundation Classes (in C++)

#include  #include    class CHelloWin : public CWnd { protected:  DECLARE_MESSAGE_MAP()  afx_msg void OnPaint(void)  {  CPaintDC dc(this);  dc.TextOut(15, 3, TEXT("Hello, world!"), 13);  } };   BEGIN_MESSAGE_MAP(CHelloWin, CWnd)  ON_WM_PAINT() END_MESSAGE_MAP()   class CHelloApp : public CWinApp {  virtual BOOL InitInstance(); };   CHelloApp theApp; LPCTSTR wndClass;   BOOL CHelloApp::InitInstance() {  CWinApp::InitInstance();  CHelloWin* hello = new CHelloWin();  m_pMainWnd = hello;  wndClass = AfxRegisterWndClass(CS_VREDRAW | CS_HREDRAW, 0, (HBRUSH)::GetStockObject(WHITE_BRUSH), 0);  hello->CreateEx(0, wndClass, TEXT("Hello MFC"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 120, 50, NULL, NULL);  hello->ShowWindow(SW_SHOW);  hello->UpdateWindow();  return TRUE; } 

[edit]Adobe Flex MXML

 version="1.0" encoding="utf-8"?>  xmlns:mx="http://www.adobe.com/2006/mxml">  text="Hello, world!"/> > 


This creates a message box saying "Hello, world!".

OutFile "HelloWorld.exe" Name "Hello, world!" Caption "Hello, world!"   Section Hello, world! SectionEnd   Function .onInit     MessageBox MB_OK "Hello, world!"      Quit FunctionEnd 


Uses lablgtk

let () =    let window = GWindow.window ~title:"Hello" ~border_width:10 () in     window#connect#destroy ~callback:GMain.Main.quit;     let button = GButton.button ~label:"Hello World" ~packing:window#add () in       button#connect#clicked ~callback:window#destroy;       window#show ();       GMain.Main.main () 


See also TUI section.

(On Psion Series 3 and later compatible PDAs.)

PROC guihello:   ALERT("Hello, world!","","Exit") ENDP 


PROC hello:    dINIT "Window Title"    dTEXT "","Hello, world!"    dBUTTONS "OK",13    DIALOG ENDP 

[edit]Pure Data

Patch as ASCII-art:

[Hello, world!( | [print] 

Patch as sourcecode:

#N canvas 0 0 300 300 10; #X msg 100 150 Hello, world!; #X obj 100 200 print; #X connect 0 0 1 0; 


Using Tkinter:

from Tkinter import *   root = Tk() Label(root, text="Hello, world!").pack()   root.mainloop() 

Using PyQt:

import sys from PyQt4.QtCore import * from PyQt4.QtGui import *   app = QApplication(sys.argv) label = QLabel("Hello, World!") label.show() sys.exit(app.exec_()) 

Using PyGTK:

from gtk import *   label = Label("Hello, world!") label.show()   window = Window() window.add(label) window.show()   main() 

Using Curves:

from math import *   def f(x):     return int(round(96.75 + -21.98*cos(x*1.118) + 13.29*sin(x*1.118) + -8.387*cos(2*x*1.118)\                + 17.94*sin(2*x*1.118) + 1.265*cos(3*x*1.118) + 16.58*sin(3*x*1.118)\                + 3.988*cos(4*x*1.118) + 8.463*sin(4*x*1.118) + 0.3583*cos(5*x*1.118)\                + 5.878*sin(5*x*1.118)))   print "".join([chr(f(x)) for x in range(12)]) 

[edit]Qt toolkit (in C++)

 #include   #include     int main(int argc, char * argv[])  {      QApplication app(argc, argv);      QMessageBox::information(0, "Qt4", "Hello World!");  } 


 #include   #include   #include   #include     class HelloWorld : public QWidget  {      Q_OBJECT    public:      HelloWorld();      virtual ~HelloWorld();  public slots:      void handleButtonClicked();      QPushButton *mPushButton;  };    HelloWorld::HelloWorld() :      QWidget(),      mPushButton(new QPushButton("Hello, world!", this))  {    connect(mPushButton, SIGNAL(clicked()), this, SLOT(handleButtonClicked()));  }    HelloWorld::~HelloWorld() {}    void HelloWorld::handleButtonClicked()  {      std::cout << "Hello, world!" << std::endl;  }    int main(int argc, char *argv[])  {      QApplication app(argc, argv);      HelloWorld helloWorld;      app.setMainWidget(&helloWorld);      helloWorld.show();      return app.exec();  } 


 #include   #include   #include     int main(int argc, char *argv[])  {      QApplication app(argc, argv);        QWidget *window = new QWidget;      QVBoxLayout *layout = new QVBoxLayout(window);      QPushButton *hello = new QPushButton("Hello, world!", window);        //connect the button to quitting      hello->connect(hello, SIGNAL(clicked()), &app, SLOT(quit()));        layout->addWidget(hello);      layout->setMargin(10);      layout->setSpacing(10);        window->show();        return app.exec();  } 


See also TUI section.

view layout [text "Hello, world!"] 

[edit]Robotic (MegaZeux)

* "Hello, world!" end 


See also TUI section.

(On Hewlett-Packard HP-48G and HP-49G series calculators.)

<< "Hello, world!" MSGBOX >> 


Hello () TEXT "Hello, world!" 

[edit]Ruby with WxWidgets

See also TUI section.

require 'wxruby'   class HelloWorldApp < Wx::App  def on_init   ourFrame = Wx::Frame.new(nil, -1, "Hello, world!").show   ourDialogBox = Wx::MessageDialog.new(ourFrame, "Hello, world!", "Information:", \                  Wx::OK|Wx::ICON_INFORMATION).show_modal  end end   HelloWorldApp.new.main_loop 

[edit]Ruby with GTK+

See also TUI section.

require 'gtk2'   Gtk.init window = Gtk::Window.new window.signal_connect("delete_event") { Gtk.main_quit; false } button = Gtk::Button.new("Hello, world!") button.signal_connect("clicked") { Gtk.main_quit; false } window.add(button) window.show_all Gtk.main 

[edit]Ruby with Tk

See also TUI section

require 'tk'   window = TkRoot.new { title 'Hello, world!' } button = TkButton.new(window) {  text 'Hello, world!'  command proc { exit }  pack }   Tk.mainloop 


See also TUI section.

Evaluate in a workspace:

Dialog confirm: 'Hello, world!' 

Using the Morphic GUI toolkit of Squeak Smalltalk:

('Hello, world!' asMorph openInWindow) submorphs second color: Color black 

Using wxSqueak:

Wx messageBox: 'Hello, world!' 

[edit]SWT (in Java)

import org.eclipse.swt.SWT; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Label;  public class SWTHello {      public static void main (String [] args) {          Display display = new Display ();          final Shell shell = new Shell(display);          RowLayout layout = new RowLayout();          layout.justify = true;          layout.pack = true;          shell.setLayout(layout);          shell.setText("Hello, world!");          Label label = new Label(shell, SWT.CENTER);          label.setText("Hello, world!");          shell.pack();          shell.open ();          while (!shell.isDisposed ()) {              if (!display.readAndDispatch ()) display.sleep ();          }          display.dispose ();      }  } 


See also TUI section.

label .l -text "Hello, world!" pack .l 

and the same in one line

pack [label .l -text "Hello, world!"] 

[edit]Tcl with Tk

package require Tk tk_messageBox -message "Hello, world!" 


package require Tk pack [button .b -text "Hello, world!" -command exit] 


 Ubercode 1 class Hello  public function main()  code    call Msgbox("Hello", "Hello, world!")  end function  end class 


 message "Hello, world!" 



Sub Main()     MsgBox "Hello, world!" End Sub 

[edit]Visual Basic .NET 2003/2005

Private Sub Form_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load   MessageBox.Show("Hello, world!")   Me.Close()     End Sub 

Note that the previous example will only work when the code is entered as part of a Form Load Event, such as the one created by default when generating a new project in the Visual Studio programming environment. Equivalently, the following code is roughly equivalent to the traditional Visual Basic 6 code by disabling the Application Framework and setting 'Sub Main' as the entry point for the application:

Public Module MyApplication   Sub Main()      MessageBox.Show("Hello, world!")   End Sub End Class 

or using a class;

Public Class MyApplication   Shared Sub Main()      MessageBox.Show("Hello, world!")   End Sub End Class 

[edit]Visual Prolog (note box)

#include @"pfc\vpi\vpi.ph"  goal   vpiCommonDialogs::note("Hello, world!"). 

[edit]Windows API (in C)

This uses the Windows API to create a full window containing the text. Another example below uses the built-in MessageBox function instead.

/*  Name: Win32 example  Copyright: GLP  Author: Ryon S. Hunter( BlackNine313@gmail.com )  Date: 20/03/07 17:11  Description: This is an example of what a Win32 hello world looks like. */ #include  #define APPTITLE "Win32 - Hello world" BOOL InitInstance(HINSTANCE,int); ATOM MyRegisterClass(HINSTANCE); LRESULT CALLBACK WinProc(HWND,UINT,WPARAM,LPARAM); LRESULT CALLBACK WinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {        PAINTSTRUCT ps;        COLORREF c = RGB( 0, 0, 0 );        HDC hdc;        RECT rt;        switch(message)        {                       case WM_DESTROY: // Exit the window? Ok                             PostQuitMessage(0);                       break;                        case WM_PAINT:                            GetClientRect( hWnd, &rt );                            hdc = BeginPaint( hWnd, &ps );                            DrawText( hdc, "Hello world!", sizeof( "Hello world!" ), &rt, DT_CENTER );                            EndPaint( hWnd, &ps );                       break;        }        return DefWindowProc(hWnd,message,wParam,lParam); } ATOM MyRegisterClass(HINSTANCE hInstance) {     WNDCLASSEX wc;     wc.cbSize = sizeof( WNDCLASSEX );     wc.style = CS_HREDRAW | CS_VREDRAW;     wc.lpfnWndProc = (WNDPROC)WinProc;     wc.cbClsExtra = 0;     wc.cbWndExtra = 0;     wc.hInstance = 0;     wc.hIcon = NULL;     wc.hCursor = LoadCursor( NULL, IDC_ARROW );     wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);     wc.lpszMenuName = NULL;     wc.lpszClassName = APPTITLE;     wc.hIconSm = NULL;       return RegisterClassEx(&wc); } BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) {     HWND hWnd;     hWnd = CreateWindow( // Create a win32 window          APPTITLE,          APPTITLE,          WS_OVERLAPPEDWINDOW,          CW_USEDEFAULT,          CW_USEDEFAULT,          500,          400,          NULL,          NULL,          hInstance,          NULL);     if(!hWnd){ return FALSE; }     ShowWindow( hWnd, nCmdShow );     UpdateWindow( hWnd );     return TRUE; } int WINAPI WinMain( HINSTANCE hInstance,                     HINSTANCE hPrevInstance,                     LPSTR lpCmdLine,                     int nCmdShow ) {                     MSG msg;                     MyRegisterClass(hInstance);                     if(!InitInstance( hInstance,nCmdShow) )                                       return 1;                     while( GetMessage( &msg, NULL, 0, 0 ) )                     {                            TranslateMessage( &msg );                            DispatchMessage( &msg );                     }                     return msg.wParam; } 


 version="1.0"?>  href="chrome://global/skin/" type="text/css"?>  id="yourwindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">  value="Hello, World!"/> > 


with(Maplets): with(Maplets[Elements]): maplet := Maplet( "Hello world!" ): Display( maplet ); 

[edit]Document formats


The following sequence of characters, expressed in hexadecimal notation (with carriage return and newline characters at end of sequence):

48 65 6C 6C 6F 2C 20 77 6F 72 6C 64 21 0D 0A 

The following sequence of characters, expressed as binary numbers (with cr/nl as above, and the same ordering of bytes):

00-07: 01001000 01100101 01101100 01101100 01101111 00101100 00100000 01110111 08-0E: 01101111 01110010 01101100 01100100 00100001 00001101 00001010 

[edit]Page description languages

[edit]XHTML 1.1

(Using UTF-8 character set.)

  version="1.0" encoding="UTF-8" standalone="no"?>   xmlns="http://www.w3.org/2000/svg" width="200" height="100">    x="50" y="50">Hello, world!>  > 


Hello, world! \bye 

[edit]LaTeX 2ε

 \documentclass{article}  \begin{document}    Hello, world!  \end{document} 


 \starttext    Hello, world!  \stoptext 

[edit]Media-based scripting languages


BlankClip() Subtitle("Hello, world!") 

(Creates a video with default properties)

[edit]Lingo (Macromedia Director scripting language)

on exitFrame me   put "Hello, world!"   end 

Outputs the string to the message window if placed in a single movie frame. Alternatively, to display an alert box stating the message you could use

on exitFrame me   alert "Hello, world!" end 


#include "colors.inc" camera {   location <3,>   look_at <3,0,0> } light_source { <500,500,-1000> White } text {   ttf "timrom.ttf" "Hello, world!" 1, 0   pigment { White } } 

[edit]Esoteric programming languages

This page shows the Hello, world! program in esoteric programming languages — that is, working programming languages that were designed as experiments or jokes and were not intended for serious use.


 use java.lang.*;  main  {      System->out->println[ 'Ofin al3alam!' ];  } 


"!dlrow olleH">v                :                ,               ^_@ 
v v"Hello, world!!"< >                  ^ > >:#v_@ ^   .< 
0"!dlrow olleH">,:#<_@>

[edit]BlooP, FlooP

From Eric Raymond's interpreter package (changed to use upper case as in the book).

   DEFINE PROCEDURE ''HELLO-WORLD''[N]:    BLOCK 0: BEGIN        PRINT['Hello, world!'];    BLOCK 0: END. 


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


   Hello, world! Souffle.       Ingredients.    72 g haricot beans    101 eggs    108 g lard    111 cups oil    32 zucchinis    119 ml water    114 g red salmon    100 g dijon mustard    33 potatoes        Method.    Put potatoes into the mixing bowl.    Put dijon mustard into the mixing bowl.    Put lard into the mixing bowl.     Put red salmon into the mixing bowl.    Put oil into the mixing bowl.    Put water into the mixing bowl.    Put zucchinis into the mixing bowl.    Put oil into the mixing bowl.    Put lard into the mixing bowl.    Put lard into the mixing bowl.    Put eggs into the mixing bowl.    Put haricot beans into the mixing bowl.    Liquefy contents of the mixing bowl.    Pour contents of the mixing bowl into the baking dish.        Serves 1. 

[edit]Cow programming language

MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MoO MoO MoO MoO MoO MoO MoO Moo Moo MoO MoO MoO Moo OOO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo Moo MOo MOo MOo MOo MOo MOo MOo MOo Moo MoO MoO MoO Moo MOo MOo MOo MOo MOo MOo Moo MOo MOo MOo MOo MOo MOo MOo MOo Moo OOO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo


"Hello, World! " 

The newline before the terminating quote mark is necessary.



[edit]INTERCAL programming language

   PLEASE DO ,1 <- #13    DO ,1 SUB #1 <- #238    DO ,1 SUB #2 <- #112    DO ,1 SUB #3 <- #112    DO ,1 SUB #4 <- #0    DO ,1 SUB #5 <- #64    DO ,1 SUB #6 <- #238    DO ,1 SUB #7 <- #26        DO ,1 SUB #8 <- #248    DO ,1 SUB #9 <- #168    DO ,1 SUB #10 <- #24    DO ,1 SUB #11 <- #16    DO ,1 SUB #12 <- #158    DO ,1 SUB #13 <- #52    PLEASE READ OUT ,1    PLEASE GIVE UP 





The text "Hello, world!" is built into the interpreter. The following code calls out the text to the output stream.


[edit]Malbolge programming language


[edit]P programming language

"Hello, world!\n" 


Not really an esoteric language, but this code uses obfuscation:

qq chop lc and print chr ord uc q chop uc and print chr ord q ne sin and  print chr ord qw q le q and print chr ord q else and print chr ord q pop  and print chr oct oct ord uc qw q bind q and print chr ord q q eq and print  chr ord qw q warn q and print chr ord q pop and print chr ord q qr q and  print chr ord q else and print chr ord qw q do q and print chr hex length  q q semctl setpgrp chop q 

[edit]PingPong Programming Language

PingPong Programming Language

1-dlroW$ olleH#/<\@                \./ 


Example Hello world image



The Infamous Hello, world! Program.  Romeo, a young man with a remarkable patience. Juliet, a likewise young woman of remarkable grace. Ophelia, a remarkable woman much in dispute with Hamlet. Hamlet, the flatterer of Andersen Insulting A/S.                      Act I: Hamlet's insults and flattery.                     Scene I: The insulting of Romeo.  [Enter Hamlet and Romeo]  Hamlet:  You lying stupid fatherless big smelly half-witted coward!  You are as stupid as the difference between a handsome rich brave  hero and thyself! Speak your mind!   You are as brave as the sum of your fat little stuffed misused dusty  old rotten codpiece and a beautiful fair warm peaceful sunny summer's  day. You are as healthy as the difference between the sum of the  sweetest reddest rose and my father and yourself! Speak your mind!    You are as cowardly as the sum of yourself and the difference  between a big mighty proud kingdom and a horse. Speak your mind.   Speak your mind!  [Exit Romeo]                     Scene II: The praising of Juliet.  [Enter Juliet]  Hamlet:  Thou art as sweet as the sum of the sum of Romeo and his horse and his  black cat! Speak thy mind!  [Exit Juliet]                     Scene III: The praising of Ophelia.  [Enter Ophelia]  Hamlet:  Thou art as lovely as the product of a large rural town and my amazing  bottomless embroidered purse. Speak thy mind!   Thou art as loving as the product of the bluest clearest sweetest sky  and the sum of a squirrel and a white horse. Thou art as beautiful as  the difference between Juliet and thyself. Speak thy mind!  [Exeunt Ophelia and Hamlet]                      Act II: Behind Hamlet's back.                     Scene I: Romeo and Juliet's conversation.  [Enter Romeo and Juliet]  Romeo:  Speak your mind. You are as worried as the sum of yourself and the  difference between my small smooth hamster and my nose. Speak your  mind!  Juliet:  Speak YOUR mind! You are as bad as Hamlet! You are as small as the  difference between the square of the difference between my little pony  and your big hairy hound and the cube of your sorry little  codpiece. Speak your mind!  [Exit Romeo]                     Scene II: Juliet and Ophelia's conversation.  [Enter Ophelia]  Juliet:  Thou art as good as the quotient between Romeo and the sum of a small  furry animal and a leech. Speak your mind!  Ophelia:  Thou art as disgusting as the quotient between Romeo and twice the  difference between a mistletoe and an oozing infected blister! Speak  your mind!  [Exeunt] 


   /e+++++++++++++++++++++++++++++.\      ./\/\/\  /+++\!>.+++o.l.+++++++l/                  #/?\   $H!\++++++\ +   \comma.------------ .+.!\-/  \!\/\/\/\/ \++++++++++/ 

Modular SNUSP:

      /@@@@++++#               #+++@@\                #-----@@@\n $@\H.@/e.+++++++l.l.+++o.>>++++.< .<@/w.@\o.+++r.++@\l.@\d.>+.@/.#   \@@@@=>++++>+++++<<@+++++#       #---@@/!=========/!==/ 

[edit]Spoon (programming language)

0101111111110010001111111111010000001101100101001011111110010001111110 1000000110111001010111111100101000101011100101001011111111111001000110 0000000000000000001000000110110000010100000000000000000000000000000000 0000000101001011111111111001000111111101000000110110010100101111110010 0011111101000000110110010101110010100000000000000000000010100000000000 0000000000000000101001011111111111001000110000000000000000000100000011 011000001010 

[edit]Super NAND Time!!

12 (32 35 37 38 42) 13 (35 37 38 39 43) 14 ((31 36 39 42 43)) 15 (31 33 34 35 38 40 43) 16 (37 39) 17 ((31 43)) 18 ((36 42 43)) 20 ((42(43))) 21 44 31 ((31)(44)) 32 (32(31)) 33 (33(32)) 34 (34(33)) 35 (35(34)) 36 (36(35)) 37 (37(36)) 38 (38(37)) 39 (39(38)) 40 (40(39)) 41 (41(40)) 42 (42(41)) 43 (43(42)) 44 1 

[edit]Taxi programming language

"Hello, World!" is waiting at the Writer's Depot. Go to Writer's Depot: west 1st left, 2nd right, 1st left, 2nd left. Pickup a passenger going to the Post Office. Go to the Post Office: north 1st right, 2nd right, 1st left. Go to the Taxi Garage: north 1st right, 1st left, 1st right. 

[edit]T programming language

%begin @jump $main %main.0 @echo %msg %main.1 @end %main.count 2 %msg Hello, world! 


x=Hello,world! x=print 

[edit]Unlambda programming language

  `r```````````.H.e.l.l.o. .w.o.r.l.di 

[edit]Var'aq programming language

Note: actually prints "What do you want, universe?" in Klingon.

    ~ nuqneH { ~ 'u' ~ nuqneH disp disp } name    nuqneH 


Note that whitespace has been highlighted (Space, Tab)

       	  	    		    	    		  	 	 		    	     		 		   		    		    		 		   		     	      		 				 		    	 	    	 		   		    		     	      		    			    			 			 		     	       		 				 		    	  	    			  	  		    	 	     		 		   		    	 		    		   	   		    		      	    	 		    		 	    		 	 		    			     	 	  		    				      	 	      empty-line     	 empty-line  			  empty-line 	  	  	      	 	    empty-line   	 empty-line    	  empty-line empty-line/EOF 

[edit]XS programming language

Hello, world! 


A code language that draws in binary on a braille plotter (note that this is just the word HELLO).

BGN GRPLOT BIN DRAWPLOT  00000000000000000000000000000000000000000000000000000000 00111001110011111110011100000000111000000000011111000000 00010000100001000010001000000000010000000000100000100000 00010000100001000000001000000000010000000000100000100000 00011111100001111000001000000000010000000000100000100000 00010000100001000000001000000000010000000000100000100000 00010000100001000010001000000000010000000000100000100000 00111001110011111110011111111000111111110000011111000000 00000000000000000000000000000000000000000000000000000000  ENDDRAW END

1 comment:

  1. I have read so many articles or reviews about the blogger lovers however this article is
    actually a nice paragraph, keep it up.

    Stop by my weblog minuman berenergi