Hello World In Many Programming Languages

If you are confused about whether or not your selected language is a programming language take this easy test to determine it: if it is possible to modify the program to print the greeting ten times without duplicating code, then it most likely is a programming language. ConvertSpacesToTabsNotForCode


‘AARDVARK’ (“kroink”)=Hello;(“groatch”)=World


ActionScript trace(‘hello world’);


actsl from http://compilers.iecc.com/comparch/article/07-10-055 int nul fun main

	"Hello World!n" arg call printf ref nul =
  1. return

endfun


AdaLanguage:

 procedure HELLO_WARD is
 begin

What about Tandy TRS 80 (Level 1) with 4k Ram 1 p. “Hello World” 2 End

  PUT ("Hello, Ward");
 end HELLO_WARD;

Is a variation on the version offered in Understanding Ada by Ken Shumate.


AlephLanguage:

 * Direct way(s) (either on a file hello.als or at the interpreter prompt):

 println "Hello World!"

 trans a "Hello World!"
 a

 * A bit more involved (let functions be!):

 trans hello nil { println "Hello World!" }
 hello

 * Even more (OO to the mêlée):

 const Hello (class)
 trans Hello:greet nil { String "Hello World!" }
 const nice-user (Hello)
 trans nice-user:hello nil { println (this:greet) }

 nice-user:hello

It is nice🙂 — DavidDeLis


Algol-60 from http://www.cis.cau.edu/Curriculum/476/chapter2/algol60/sld009.htm

  BEGIN
  FILE F(KIND=REMOTE);
  EBCDIC ARRAY E[0:11];
  REPLACE E BY "HELLO WORLD!";
  WHILE TRUE DO
	BEGIN
	WRITE(F,*,E);
	END;
  END.

This looks like an infinite loop rather than just a simple Hello World, of course; maybe the author just wanted to add an illustration of a loop. The EBCDIC keyword is an anachronism relative to the original Algol-60 and 1962 revised report; IBM introduced EBCDIC with the IBM 360 in 1964 (after the 1963 introduction of ASCII, BTW). This casts some doubt on the strict faithfulness of the entire example. The example appears to be from a student report, so that wouldn’t be surprising. I’ve seen keywords marked by quote marks in some version of Algol…not sure if it was Algol 60 or 68, or if it was a standard of nonstandard convention. That would probably have been Algol-60. If I remember my history correctly, Algol-60, as the first attempt at an intentionally portable language, was something of a victim of timing. When Algol was designed, there wasn’t even a common character set, computer scientists weren’t quite sure what constituted things like basic I/O operations, sharing of data between computers (when done at all) was an ad hoc, manual process often involving modified hardware, and it wasn’t clear what the best way to differentiate language expression names from user-defined variables would be (mind you, some of those things aren’t all that clear now…). What’s more, many of the designers wanted to be able to use arbitrary mathematical notation in the published algorithms, even though the actual production code generally could not support them. As a compromise, it was decided that the language design would concentrate on portability of algorithms, rather than of actual source code per se. Thus, they defined three different languages: a ‘reference’ Algol for the language definition, a ‘publication’ Algol for publishing algorithms in, and am ‘implementation’ language, which was what the compilers would actual read. Only the reference language was strictly defined. The publication language could use whatever notation was convenient, so long as it stuck to the general Algol syntax. The implementation language would try to match the reference language to the capabilities of the specific machines. One result of this was that different Algol compilers often had very different ideas of what defined a keyword. Some used fixed keywords, like most conventional modern languages; but others would differentiate them in various ways, such as having keywords being all-caps, or in quotation marks, or in a different typeface (!). Still other followed FORTRAN and PL/1 and tried to determine them from context. By modern definitions, then, Algol was not one language but a family of similar but incompatible dialects. This is all from memory, out of books I read several years ago; CommentsAndCorrectionsWelcome. – JayOsako This program appears to orginate from http://www.engin.umd.umich.edu/CIS/course.des/cis400/algol/hworld.html which indicates that the program was written for a Burroughs/Unisys A-series mainframe, and that it has not been tested due to an inability to locate such a machine or a compatible compiler. – AnonymousDonor


AmigaE (AmigaEe):

 PROC main()
	PrintF('Hello worldn')
 ENDPROC

But if you want to use some OOP for more interest:

 PROC main() HANDLE
	DEF message=NIL:PTR TO printMessage	->object to be allocated

	NEW message.new('Hello worldn')
	message.print()
 EXCEPT DO
	END message
	IF exception
	PrintF('Exception raised:  s.n', IF exceptioninfo THEN exceptioninfo ELSE 'Unknown')
	ENDIF
 ENDPROC

 OBJECT printMessage PRIVATE
	message:PTR TO CHAR	->message to be printed
 ENDOBJECT

 /* This is the constructor */
 PROC new(message:PTR TO CHAR) OF printMessage
	self.message := message
 ENDPROC

 /* This is a normal method */
 PROC print(addNewLine=FALSE) OF printMessage
	IF addNewLine = FALSE
	PrintF(self.message)
	ELSE
	PrintF('sn', self.message)
	ENDIF
 ENDPROC

Please note that AmigaE is case-sensitive, that keywords must be uppercase, and that user-defined names must at-least start with a lower-case letter.


APL (AplLanguage)

 'Hello World'

AppleScript

  on helloWorld()
	display dialog "Hello World!" buttons {"OK"}
  end helloWorld

  helloWorld()

AssemblyLanguage for the IBM-PC (i386):

  dosseg
  .model small
  .stack 100h

  .data
  hello_message db 'Hello, World!',0dh,0ah,'$'

  .code
  main  proc
 mov ax,@data
 mov ds,ax

 mov ah,9
 mov dx,offset hello_message
 int 21h

 mov ax,4C00h
 int 21h
  main  endp
  end main

But nowadays, we do it in protected mode in Linux.

 .text

 .global _start
 _start:

 mov $4, %eax /* write system call */
 mov $1, %ebx /* stdout */
 mov $msg, %ecx
 mov $msgend-msg, %edx
 int $0x80

 mov $1, %eax /* _exit system call */
 mov $0, %ebx /* EXIT_SUCCESS */
 int $0x80

 .data

 msg: .ascii "Hello, worldn"
 msgend:

(Very nice, but gas/gcc format should be:

 .global main
 main:

I have just checked it.. otherwise, it’s cool, my assembler days are long gone…) Nope. That is if you want to use the libc and use the C startup code. The above program, however, does not require any C library code to be linked; it calls directly to the kernel through the interrupt 0x80 interface.


IBM 360/370/390 BAL (Basic Assembler Language)

 // EXEC ASSEMBLY
	  START
 MAIN	BALR  2,0
	  USING *,2
	  OPEN  PRINT
	  MVC	BUF,HW
	  PUT	PRINT
	  CLOSE PRINT
	  EOJ
 HW	DC	CL132'HELLO WORLD'
 BUF	DS	CL132
 PRINT	DTFPR IOAREA1=BUF,DEVADDR=SYSLST,BLKSIZE=132,		*
		DEVICE=3203,CONTROL=YES,PRINTOV=YES 
	  END	MAIN
 /*
 // EXEC LNKEDT
 // EXEC
 /*
 /&

(Ahhh… those were the days) Sorry, had to tweak it! Opcodes start in col. 10; operands in col. 16. These two rules aren’t essential – an opcode can start as early as col. 2. Continuation character is in col. 72 (didn’t bother spacing that far over). Continuations of statements on the next line start at col. 16. These last two rules are essential.


AwkLanguage:

  echo "" | awk 'BEGIN{print "Hello World"}'

or

  echo "Hello World" | awk '{print $0}'

GNU Awk:

  awk 'BEGIN{print "Hello World"}'

B (BeeLanguage):

 main( ) {
 	putchar('hell');
 	putchar('o, w');
 	putchar('orld');
 	putchar('*n' );
 }

AdamBerger


BasicLanguage

 10 PRINT "HELLO WORLD"

(Obviously optional, but included 99.999% of the time…)

 20 GOTO 10
 RUN (AWAY, LAUGHING)

Poor old Basic – everybody’s forgotten you…


BefungeLanguage:

 0".dlrow ,olleH">v
		 ,:
		 ^_@

BlitzMax? (http://www.blitzmax.com) Can be done in two variants

	Print "Hello World!"

Or if you want it in a nice dialog box

	Notify "Hello World!"

Bourne Shell:

 #!/bin/sh
 echo hello, world

BrainLanguage (brain hello.brn):

 "Hello, world" println.

BrainfuckLanguage (an EsotericProgrammingLanguage):: >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++. [-]>++++++++[<++++>-]<.>+++++++++++[<+++++>-]<. >++++++++[<+++>-]<.+++.——.——–.[-]>++++++++[<++++>-]<+. [-]++++++++++. >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++. [-]>++++++++[<++++>-]<.#>+++++++++++[<+++++>-]<. >++++++++[<+++>-]<.+++.——.——–.[-]>++++++++[<++++>-]<+. [-]++++++++++. — DavidHooker shorter:

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

C (CeeLanguage) (according to KernighanAndRitchie):

 #include <stdio.h>
 #include <stdlib.h>

 int main(void)
 {
  printf("Hello, worldn");
  return EXIT_SUCCESS;
 }

CsharpLanguage:

 class Hello {
 	static void Main() {
  		System.Console.Write("Hello World");
 	}
 }

C++ (CeePlusPlus)

 #include <iostream>

 int main()
 {
 	std::cout << "Hello, World." << std::endl;
 }

The code does not actually need the

 return 0; // an integer return value is expected. Thou shalt not remove this line!

to be conformant – main will implicitly return 0 if no return value is given. See 3.6.1.5 (http://www.open-std.org/jtc1/sc22/open/n2356/basic.html#basic.start.main) — ScottMcMurray


Cobol

 IDENTIFICATION DIVISION.
 PROGRAM-ID. Hello.
 ENVIRONMENT DIVISION.
 DATA DIVISION.
 PROCEDURE DIVISION.
	Display 'Hello, World'.
	STOP RUN.

ColdFusion Tag based:

 <cfset hello = "Hello World!">
 <cfoutput>#hello#</cfoutput>

Script based:

 <cfscript>
	WriteOutput("Hello World!");
 </cfscript>

COM HelloWorld client:

 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <objbase.h>
 #include <iostream.h>
 #include <tchar.h>
 #import "HelloSrv?.tlb"
 void _tmain (int argc, TCHAR * argv[])
 {
  	if (S_OK == CoInitialize?(NULL))
  	{
 		try
 		{
 			HELLOSRVLib::IHelloWorld p(__uuidof(HELLOSRVLib::HelloWorld));
 			p->Hello();
 		}
 		catch (const _com_error& Err)
 		{
 			cerr << Err.ErrorMessage?() << endl;
 		}
 		CoUninitialize?();
  	}
  	else
  	{
 		cerr << "Error during OLE initialization" << endl;
  	}
 }

PhilipEskelin


RM COBOL:

 000100 IDENTIFICATION DIVISION.
 000200 PROGRAM-ID. HELLOWORLD.
 000300
 000400*
 000500 ENVIRONMENT DIVISION.
 000600 CONFIGURATION SECTION.
 000700 SOURCE-COMPUTER. RM-COBOL.
 000800 OBJECT-COMPUTER. RM-COBOL.
 000900
 001000 DATA DIVISION.
 001100 FILE SECTION.
 001200
 100000 PROCEDURE DIVISION.
 100100
 100200 MAIN-LOGIC SECTION.
 100300 BEGIN.
 100400 DISPLAY " " LINE 1 POSITION 1 ERASE EOS.
 100500 DISPLAY "Hello world!" LINE 15 POSITION 10.
 100600 STOP RUN.
 100700 MAIN-LOGIC-EXIT.
 100800 EXIT.

CommonLisp: Interactively (at the ReadEvalPrintLoop): “Hello World!” If you’re picky and you want a file you can “execute” which will write the sequence “Hello World!n” on stdout: (write-line “Hello World!”)


COW (an EsotericProgrammingLanguage): see: http://www.bigzaphod.org/cow/ MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO 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 Is this code translated from the BrainfuckLanguage code given above? — AnonymousDonor


D See: http://www.digitalmars.com/d/

  import std.c.stdio;

  int main(char[][] args)
  {
	printf("Hello, World!n");
	return 0
  }

PaulRuane


DeeCee

 [Hello, world!] p

DOS (DiskOperatingSystem) command.com Shell Script:

 echo Hello World

Mac users often confuse the operating system with the small sample shell that came with it. It was claimed that DOS did not qualify as a programming language, according to the test given at the top of the page. However, consider the following cmd.exe shell script:

 for /l %i in (1,1,10) do echo Hello World

(at least under NT-like shells)


EiffelLanguage:

 class HELLO
 creation make
 feature make is
 do
 print ("Hello, World%N")
 end
 end -- class HELLO

ErlangLanguage: In file hello.erl:

 -module(hello).
 -export([hello_world/0]).

 hello_world() -> io:fwrite("hello, worldn").

in erl (or esh, or compiling it):

 > c(hello).
 > hello:hello_world().

EtcLanguage:

  ##X#

Evil (http://bite.to/evil)

 MUHUHAHAHA
 Acid
 Beat Sucker 72 times
 Beat Gay 69 times
 Beat Sissy 76 times
 Beat Dick 79 times
 Beat Twat 87 times
 Beat Nerd 82 times
 Beat Faggot 68 times
 Shout SuckerGaySissySissyDick? TwatDickNerdSissyFaggot?!
 ENDMUHUHAHAHA

For non-programmers: These examples are mere toys! Don’t forget the real thing, GNU HelloWorld at http://www.gnu.org/software/hello/ From the page:

 The GNU `hello' program produces a familiar, friendly greeting. It
 allows nonprogrammers to use a classic computer science tool which
 would otherwise be unavailable to them.

 Yes, this really is the classic program that prints "Hello, world!"
 when you run it. Unlike the elementary version often presented in
 books like K&R, GNU hello processes its argument list to modify its
 behavior, supports internationalization, and includes a mail
 reader. The primary purpose of this program is to demonstrate how to
 write other programs that do these things; it serves as a model for
 all of the GNU coding standards.

This is an interesting corollary to the joke among Windows programmers that the last Windows program was written sometime in 1994; everything since then has been a modification of HELLO.C from Petzold. Sadly, I actually worked on a commercial product where that was the case.


Forte TOOL:

 task.part.logmgr.putline( 'Hello World ' );

DavidVydra


ForthLanguage:

 CR .( Hello, world!)

FortranLanguage — this works both with f77 and f90

 PROGRAM HELLOWORLD
 10 FORMAT (1X,11HHELLO WORLD)
 WRITE(6,10) 
 END

FrinkLanguage

 println["Hello World!"]

GoogleplexianLanguage:

 obbs["Hello World!"]xx:

HaskellLanguage:

 main = do putStrLn "Hello, world."

— LoganHanks? In file HelloWorld.hs:

 module Main where

 main = putStrLn "Hello, World!n"

Then compile it or call it (eg. using hugs98: hugs HelloWorld.hs and at the prompt -> main)


HqNinePlusLanguage

 h

HtagLanguage

 Hello World

executed as helloworld.htag if htag is properly associated with the interpreter, or as htag helloworld.htag if it isn’t. Here if it’s called as http://localhost/helloworld.htag:

 <!%WRITECONTENTTYPE%>
 <html><head>
 <title>Hello world</title>
 </head>
 <body>
 Hello World
 </body>

This is also the reason why I created HtagLanguage, so I don’t need unnecessary fluff. — SvenNeumann


HTML not a programming language.


Icon

  procedure main(args)
	write("Hello, World!");
  end

MichaelKnight


InformLanguage

 [ Main;
	print "Hello World!^";
 ];

IoLanguage

	"Hello World!" print

IokeLanguage

	"Hello World!" println

Jakarta Velocity (JakartaVelocity)

 import java.io.StringWriter;
 import org.apache.velocity.app.Velocity;
 import org.apache.velocity.VelocityContext;

  public class HelloWorld
  {
 	public static void main(String args[])
 	throws Exception
 	{
 		Velocity.init();

 		VelocityContext context = new VelocityContext();
 		context.put("name", "World");

 		String s = "Hello $name!";
 		StringWriter w = new StringWriter();

 		Velocity.evaluate(context, w, "hello", s);

 		System.out.println(w);
 	}
 }

DimitrisTzoumpas


JavaLanguage:

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

Object oriented Java

 class Greeting {
  	void greet(Named target) {
			System.out.println("Hello, " + target.getName() + "!");
  	}
 }

 interface Named {
  	String getName();
 }

 class World implements Named {
  	String getName() {
			return "World";
  	}
 }

 class Main {
  	public static void main( String[] args ) {
			Greeting greeting = new Greeting();
			greeting.greet(new World());
  	}
 }

Swing Java

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

JavaApplet:

 import java.applet.*;
 import java.awt.*;
 public class Hello extends Applet {
  public void paint(Graphics g) {
	g.drawString("Hello World", 25, 50);
  }
 }

JavaScript:

  document.writeln("Hello, World");

— Paul Gresham, 07NOV1999 Pop up:

 alert("Hello, World");

Note that none of these two examples are, strictly speaking, correct. They might however produce some results when being run from a specific host environment, and might even produce the intended result when this host environment happens to be a WebBrowser


J (JayLanguage)

 'Hello World'

JoyLanguage:

 "Hello World!" putln .

ShaeErisson


K (KayLanguage): `0:”Hello World”


LatteLanguage? (http://www.latte.org/):

  {def hello "Hello, World!"}
  {head {title hello}}
  {body hello}

IlmariKaronen


LISP:

	(DEFUN HELLO-WORLD ()
	(PRINT (LIST 'HELLO 'WORLD)))

LingoScriptingLanguage

 put "Hello World"

or:

 alert "Hello World"

— Welshy31


Logo the turtle language, still unbeaten in handling of sets, there is an interpreter here: http://www.cs.berkeley.edu/~bh/logo.html

  print [Hello World]

— michael


LolCode:

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

Lotus Formula:

 @Prompt([Ok];"";"Hello World")

LotusScript:

 Sub Click(Source As Button)
	Print "Hello World"
 End Sub

LuaLanguage:

 print "Hello, World."

LxLanguage:

 import IO = LX.Text_IO
 procedure HELLO() is
  IO.WriteLn "Hello World"

MicrosoftExcel Not a programming language.


ModulaThree

  MODULE Hello EXPORTS Main;
  IMPORT Stdio, Wr;
  BEGIN
 	Wr.PutText?(Stdio.stdout, "Hello World");
  END Hello.

Graphical version

  MODULE Hello EXPORTS Main;
  IMPORT Trestle, TextVBT;
  VAR v := TextVBT.New("Hello World");
  BEGIN
 	Trestle.Intall(v);
 	Trestle.AwaitDelete?();
  END Hello.

Multiple languages: All such discussions are concluded by contemplating HelloPolyGlots. Cobol, Pascal, Fortran, C, PostScript, BourneShell, Assembly: All in one single source file! That makes my cheesy little effort (Perl and C) look, well cheesy. Here it is anyway. — BruceIde

 #include <stdio.h>
 #define sub int
 #define print(a) printf("%s", a)
 sub main() {
 	print("Hello worldn");
 }

 #ifdef _perl
 main();
 #endif

NemerleLanguage: (http://www.nemerle.org)

 module Hello {
	Main(): void {
	 Nemerle.IO.printf("Hello worldn");
	}
 }

or a graphical version, using Gtk#:

 using System;
 using Gtk;
 using GtkSharp;

 module hello {
	Main(): void {
	 Application.Init();

	 def button = Button("Hello World");
	 button.Clicked += (fun(_,_) {
		Console.WriteLine("Hello World")
	 });

	 def window = Window("Helloworld");
	 window.DeleteEvent += (fun(_,_) {
		Application.Quit()
	 });

	 window.Add(button);
	 window.ShowAll();
	 Application.Run()
	}
 }

Notation3: Not a programming language.


ObjectiveCee:

 #import <Cocoa/Cocoa.h>

 @interface Greeter : NSObject {}
 - greet;
 @end

 @implementation Greeter
 - greet {
  NSLog(@"Hello, World!"); }
 @end

 int main(int argc, char *argv[]) {
  [[Greeter new] greet]; }

— MartinHëer


OpalLanguage?:

 FUN hello : denotation
 DEF hello == "Hello, World"

Since Opal is a pure functional language there is no such side-effect as outputting something to stdout the only possibillity is to call this from the interpreter and so get the string as a result. (Ok, there is an output monad, but I’m not gonna touch that.🙂 The idea is to show a program which prints out “Hello, world!” to the standard output. If it is difficult or ugly in your language, then so be it. If you are ashamed, then remove it completely.


ObjectiveCaml: At the interactive prompt:

 print_string("Hello World!");;

This is more correct (adds a newline and flushes the channel):

  print_endline "Hello, World!";;

MarcoMaggesi


PascalLanguage:

  program HelloWorld;

  begin
	writeln('Hello World');
  end.

SavasAlparslan


PathLanguage:

 $/	/	  /  /		 I wish Ward
  +++	++	  ++  ++
  +++	++  /++++  ++  ++  /++++	 would fix the
  ++++++  +	+  ++  ++  +	+
  ++	+++  +/+++/  ++  ++  +	+
  ++	+++  ++	++  ++  +	+
  /	/  /+++	/  /  /++.+/  
						backslash
  /++++.+++++++++++++++++++++++++++  /  	bug!
				/	-  -#
				++	.  -.
  +	/  ++++  /++++  ++  /----  -+
  +  /  +  +	+  +	+  +.  -	.-  ->
  +  +.  +  +	+  +	+-  -	+-  
  .  +>  +  +	+  +	+-  -	+-  -.
  .+/++/  ++++/  +	+  /-.+/-  --
			/	.</		/  /

You forgot the ‘$’. —AnonymousDonor It’s not strictly necessary for this program, since you start at the top left by default.


PerlLanguage:

 print "Hello Worldn"

Type this into a file and run it with the single command, perl hello.pl. Or provide the program on the command line, as:

 perl -e "print 'Hello, world'"

(Note: The double-quotes are placed at the outer level to be compatible with DOS-based systems – and still work with Un*x.) Or, invoke Perl as an interactive interpreter/compiler ala Forth, BASIC, etc.

 perl -e "while(<>){eval;print $@;}"
  or
 perl -ne "eval; print $@;"
  or
 perl -de 1  # given appropriate CPAN bits, this has command-line editing

and input the program directly:

 print "Hello, world"
 Hello, world  # Perl's immediate response

or even:

 sub hello { print "Hello, world" };
 hello;  # Call the subroutine we just defined
 Hello, world  # Perl's immediate response

PerlInline: Perl subsumes all languages eventually…

 perl -e 'use Inline C=>q{void hw(){printf("Hello, world!n");}};hw'

 perl -e 'use Inline Ruby=>q{def hw;puts "Hello, world!";end};hw'

BrianIngerson


Perl “Obfuscation” (taken from http://www.perlmonks.net/index.pl?node_id=329174)

			package Earth;sub Greet{
		 %_=('Y','~');$_='$;=!(Middle
		Earth.age~~~<Eart~~~~~~~~~~~~~h
		.age)?!(defined$ti~~~~~~~~~~~mez~~~On 
	  e[2])?!(push@time~~~~~~~~~~~~~~~~Zone,loc
	~altime())?rotation?~~~~~~~~~~~~~q~~?The Worl
	~~d?:q:[w]::q=[~~~~~~~~~~~~~~~~~d~a-f]=:q?..~~
	~~~?:q:.:;"42b3d3~~~~~~~~~~~~~~~~~~~~~728656c6c6f6
	~~~~~0277f627c64672~~~~~~~~~~~~~~~~~~~~~b3072796e647
	~~~~~~~42b3b3rg7d"=Ym~~~~~~~~~~~~~~~~~~~$;~~*;p~~~~u
	~~~~~~~~~sh@_,$&;bless~~~~~~~~~~~~~~~~~~~~~~~~~$c~~~~~~~
	~~~~~~~~~o~ntine~~~~~nt~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ~~~~~~~~~~~~~s=~~~~~~~$~~~~~~~~~~~~~~~~~~~~~~~pangaea~~~~
 ~~~~~~~~~~~~~~~;{l~~~~~~~~~~~~~~~~~~~~~~~~~~~~ocal@_;local$;
 ~~~~~~~~~~~~~~~~~="o~~~~~~~~~~~~~~~~~~~~~~~~~cean";$^A=(defi
 ~~~~~~~~~~~~~~~~~~~n~~~~~~~~~~~~~~~~~~~~~~~~~ed$continents)?
 ~~~~~~~~~~~~~~~~~~~(vec(~~~~~~~~~~~~~~~~~~~~~~$;, YYsplit('
 ~~~~~~~~~~~~~~~~~',${$;}~~~~~~~~~~~~~~~~~~~~~~)%3,YYsplit(
 ~~~~~~~~~~~~~~~~q??,$;)**2-~~~~~~~~~~~~~~~~~~~~~~(($;=Ytr/oa
 ~~~~~~~~~~~~~~~~eiu//)**2))=~~~~~~~~~~~~~~~~~~~~~~=28160)?q:
 ~~~~~~~~~~~~~~~~~.::q?!?:'?~~~~~~~~~~~~~~~~~~~~~~';}$^A=Ys
  ~~~~~~~~~~~~~~~~:Q.E:pack(~~~~~~~~~~~~~~~~~~~~~~'h*',j
	~~~~~~~~~~~~~~~~~oin(q(),~~~~~~~~~~~~~~~~~~~~~~~grep{$_=
	~~~~~~~~~~~~~~~~~~Ym,$,,}~~~~~~~~~~~~~~~~~~~~~~~split("
	~~~~~~~~~~~~~~~~~",@_~~~~~~~~~~~~~~~~~~~~~~~~~~[0]))
	~~~~~~~~~~~~~~~~):e~~~~~~~~~~~~~~~~~~~~~~~~~~~gexe
	~~~~~~~~~~~~~~~;$d~~~~~~~~~~~~~~~~~~~~~~~~~~~="s
	~~~~~~~~~~~~~~ort~~~~~~~~~~~~~~~~~~~~~~~~~~<=
	  ~~~~~~~~~~~~>,~~~~~~~~~~~~~~~~~~~~~~~~~~YY
		~~~~~~~~~~~@_~~~~~~~~~~~~~~~~~~~~~~~~
		~~~~~~~~~"~~~~~~~~~~~~~~~~~~~';;
		 s,(~|r|n|s),,g;s.Y.x7e.g;
			eval};Greet;'the world';

PhpLanguage: <?=”Hello World”?> But you have to have short tags turned on in the ini file, otherwise: <?php echo “Hello World”; ?> — BrynJones? Or just type “Hello, world!” in a file, and run php -f helloworld.php (doesn’t have to pre-process plain old text, now does it?) — Phil


Pike

  int main() {
	write("Hello Worldn");
  }

PlbLanguage (or Databus)

 DISPLAY "HELLO WORLD"
 STOP

PL/SQL

	BEGIN
	DBMS_OUTPUT.PUT_LINE('Frank and Beans');
	END;

PowerScript?

	(used in PowerSoft?/Sybase PowerBuilder)

	global type main from application
	end type
	global main main

	on main.create
	appname = "main"
	end on

	event open;MessageBox ('', 'Hello World')
	end event

PowerShell

	"Hello World"

PrographLanguage: In this now-defunct, really visual dataflow OOP language, that was very cool and way ahead of its time, the program is: (Note that in Prograph there was no “C code generation” or similar idiocy — the compiler acted directly on this hierarchical hypergraph to create executable code. Alas for visionaries everywhere….) —BillTozier


Prolog:

	go :-
	writeln('Hello World').

— TechnoKid?


PythonLanguage: You copy the following text into a file and call the file (hello.py) (remember python is sensitive of it’s indenting, which rocks🙂 )

 print "hello world"

Now invoke the interpreter and pass it your file with the single command: python hello.py


QBasic:

 ? "Hello, world!"

The only language so far with Q? (See G entry) … No I haven’t forgotten you, dear QB (See BASIC entry) — Phil P.S. (Anyone brave enough for a QuickBasic version? How about QB4.5 (mmm, compiled basic…)? VBDOS???)


Rebol

 print "Hello World"

or:

 "Hello World"

In a script:

 Rebol []
 print "Hello World"

AndrewMartin


RexxLanguage:

  say 'hello, world';

RpgLanguage – RPG Column positions are crucial – in old style RPG Columns . . . : 6 76 Browse TESTLIB/QRPGLESRC SEU==> TESTPGM FMT C CL0N01Factor1+++++++Opcode&ExtFactor2+++++++Result++++++++Len++D+HiLoEq?

	FQSYSPRT	O		  PRINTER OFLIND(*IN88)
	D*
	C			EXFMT	RECFMT
	C			EVAL	*INLR = *ON
	O RECFMT R
	O	11 'HELLO WORLD'

Free format RPG IBM finally put the cash in for something a little more readable. Columns . . . : 6 76 Browse TESTLIB/QRPGLESRC SEU==> TESTPGM

	/Free
	dsply 'Hello World';
  • INLR = *ON;
	/end-free

JoshuaRobinson


RubyLanguage:

 puts "Hello, world"

(run with ruby hello.rb or ruby -e ‘puts “Hello, world”‘)


ShellScript?:

 #!/bin/sh
 echo "Hello World"

SchemeLanguage:

 (display "Hello, World!")
 (newline)

The following version does not work unless your Scheme system contains the writes procedure, which is non-standard.

 (define hello-world
 (lambda ()
  (writes 'nil "Hello, World!")))

IainLowe I thought that at the Scheme interpreter prompt, since strings evaluate to themselves, you would just type

 "Hello World"

and the interpreter would print it right back at you. — EdwardKiser That’s true, I hadn’t thought of that. That bodes ill for SimplestThingThatCouldPossiblyWork. The same thing works in FalseLanguage. I’d even venture:

 (display "Hello, world!n")

sed:

 s;.*;Hello, Ward;
 q

Actually, this fails on empty input files. How about this:

 0i  
 Hello, world!
 d

Small Basic (Microsoft):

 TextWindow.WriteLine("Hello, World")

Also

 GraphicsWindow.DrawText(10, 10, "Hello, World")

SmalltalkLanguage:

 Transcript cr; show: 'Hello World'.

Type this into a workspace, select it and choose doit. Or, if you prefer a prototype, just type the quoted string, select it and choose printit. Then let’s see how to build an “executable” that will run in something like the same way all the other languages will. We can do anything in Smalltalk, but the packaging, oy!RonJeffries I always show this, when asked by C/C++ programmers, as a typing in of “Hello, World!,” preferably into an empty Transcript pane. And then I save the image. Loading the program subsequently brings up: “Hello, World!” Individuals will quibble over this relentlessly, saying, “It’s not the same!” I can only agree that it’s not the same, but that was my point about the languages and their environments in the first place. — JerryArchibald (Eeeh – I have an eerie feeling I’ve just walked through this exact thing from the POV of a non-Smalltalk programmer on SmalltalkHelloWorld)


SmlLanguage

  val () = print "Hello, world!n"

SnobolLanguage

 output = "Hello, world"

end


SnuspLanguage (possibly the most fun I’ve ever had writing Hello world!)

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

or in Modular SNUSP:

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

Skeleton key (the flexiblity of PathLanguage or BefungeLanguage combined with the aesthetics of Brainf**k):

  • $ : start execution here moving to the right.
  • !? : skip over one character unconditionally or if current cell is zero
  • / : reflect the instruction pointer at a right angle (should be obvious)
  • +- : increment/decrement current data cell (all cells start at zero)
  • >< : increment/decrement the data pointer (above: cell 0 for letters, cell 1 for punctuation)
  • ., : output/input an ASCII character from/to the current cell
  • @#: enter/leave a subroutine. @ pushes position and continues with the next character. # pops position and continues with the second character from when called.
  • All other characters (such as ‘=’ ‘|’ and letters) are no-ops; commentary, if you will.

There is an interpreter in Perl on the SnuspLanguage page, in case you don’t believe the above is executable!


SQL (StructuredQueryLanguage): SQL has no branching or conditionals. It is not a programming language. It is a query language. Hmm, well.

 SELECT 'Hello World!';

And how about the Oracle SQL flavour?

  SELECT 'Hello World!' FROM dual;

TeX

 Hello,~world!

or (messing with subroutines / macros)

 defhw#1{Hello,~#1}
 hw{world!} \  
 hw{Ward.}

(BTW, writing these examples I ran across a bug: end-of-line backslashes are eaten (together with the linefeed) at edit.) in LaTeX, you should use newcommand:

 newcommand{hw}[1]{Hello,~#1}

While we’re at it, let’s see the same definition in other macro processors:

 m4: define(`hw',`Hello, $1')
 cpp: #define hw(who) Hello, who

It was claimed that TeX did not qualify as a programming language, according to the test given at the top of the page. However, consider the following:

 longdefrepeat#1#2{
	count0=0
	defonceMore{
	ifnumcount0<#1
	#2
	advance count0 by 1
	onceMore
	fi
	}
	onceMore
 }
 repeat{10}{Hello,~Worldpar}
 bye

And let’s not forget that there exists a BasicLanguage interpreter written in TeX: http://texcatalogue.sarovar.org/entries/basix.html


TomLanguage:

 Implementation class HelloWorld
 int
  main Array arguments
 {
  [[[stdio out] print "Hello, world"] nl];
 }
 end;
 Implementation instance HelloWorld end;

ToolCommandLanguage puts “Hello, world”


TypoScript

 page = PAGE
 page.typeNum = 0

 page.10 = TEXT
 page.10.value = HELLO WORLD!

UnLambdaLanguage

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

VisualBasic:

 Sub Main()

 MessageBox("Hello World")

 End Sub

VisualFoxPro: – will also work in Clipper and almost any other DBase III-driven scripting language, known collectively as “Xbase” (ExBase)

 ? "Hello World"

MS VJ++ 6.0 version:

 import com.ms.wfc.app.*;
 import com.ms.wfc.core.*;
 import com.ms.wfc.ui.*;
 import com.ms.wfc.html.*;

 public class Form1 extends Form
 {
 	public Form1()
 	{
 		// Required for Visual J++ Form Designer support
 		initForm();

 	}

 	public void dispose()
 	{
 		super.dispose();
 		components.dispose();
 	}

 /**
 * NOTE: The following code is required by the Visual J++ form
 * designer. It can be modified using the form editor. Do not
 * modify it using the code editor.
 */
 	Container components = new Container();

 	private void initForm()
 	{
 		this.setText("Form1");
 		this.setAutoScaleBaseSize(new Point(5, 13));
 		this.setClientSize(new Point(292, 273));
 		this.addOnClick(new EventHandler(this.Form1_click));

 		MessageBox.show("Hello, world");
 	}

 	public static void main(String args[])
 	{
 		Application.run(new Form1());
 	}
 }

VoiceXml

 <?xml version="1.0"?>
 <vxml version="2.0">
 <form>
 <block>
  <prompt>Hello, World!</prompt>
 </block>
 </form>
 </vxml>

FredrikBreivald


XIML <el eltype=”txt” x=”23″ y=”18″ datatype=”static” dataval=”Hello, World!” font=”Verdana” color=”0xff0000″ size=”30″ /> — http://ximl.com


Whirl 110011100111000001111100000001000011111000011111100000000010 000011001111100001100010000010011111000100000000000001001111 100000111110001000000000000000001000111110010000001100001111 100011000000000100111110011100111000111000001000111000001111 100000111110010000011111000110011111100001111000001111000001 110011111100001111000110011100000111000100011111000001111100 100000110000000111000001110001111100011111000111000001000001 000011000111110001000001000000011100000111001000111110001111 000001111000011111100001111110000011110000000000000000011110 000011100111000011110011111000111110001111100000100000000000 000000000000111110001110000001110000011100011100111110001000 100000000011100001111100110000000010011111000111100000111100 111100010011100000111110000011111001100111100010001111000000 000001000111110010000010011110011001110001000111110001100000 100011111000011110011100111111000111100000111100011111000000 011110000011100100001111000100011111001100011111000111100000 111001110001100111100100000000000000011111000001111100010010 000011100001111100100000100011100000111000110011110001001111 110001100000111100011111000111100000111001000011110001001111 100000111110000000011110000011110000000000000000111000001110 000011000001100000111000111000001100111110000111111001001110 000011111000001100011000001001111110000011100110011111000000 000111000001110000111100001100 — by Kang Seonghoon 2005.1.7


Whitespace – A real language (http://compsoc.dur.ac.uk/whitespace/) Say hello.


WindowsScriptHost VBScript:

 WScript.StdOut.WriteLine "Hello, World";

JScript:

 WScript.StdOut.WriteLine("Hello, World");

WikiWiki: Not a language.

Acerca de xesle

Geek renacentista, por decir algo.
Esta entrada fue publicada en 1. Guarda el enlace permanente.

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s