Programming
Hello, World!' - In Lotsa Languages!
Basic
--------------------------------------------------------------------------------
10 print"Hello World!"
20 goto 10
Here's a 'Hello, World!' program
written in Atari Basic:
10 REM HELLO.BAS
20 POKE 764,255
30 PRINT "Hello World"
40 IF PEEK(764)=255 THEN GOTO 30
C
--------------------------------------------------------------------------------
#include <stdio.h>
main()
{
for(;;)
{
printf ("Hello World!\n");
}
}
... and a more complex one ...
#include "stdio.h"
#define e 3
#define g (e/e)
#define h ((g+e)/2)
#define f (e-g-h)
#define j (e*e-g)
#define k (j-h)
#define l(x) tab2[x]/h
#define m(n,a) ((n&(a))==(a))
long tab1[]={ 989L,5L,26L,0L,88319L,123L,0L,9367L };
int tab2[]={ 4,6,10,14,22,26,34,38,46,58,62,74,82,86 };
main(m1,s) char *s; {
int a,b,c,d,o[k],n=(int)s;
if(m1==1){ char b[2*j+f-g]; main(l(h+e)+h+e,b); printf(b); }
else switch(m1-=h){
case f:
a=(b=(c=(d=g)<<g)<'<g)<<g;
return(m(n,a|c)|m(n,b)|m(n,a|d)|m(n,c|d));
case h:
for(a=f;a=e)for(b=g<<g;b<n;++b)o[b]=o[b-h]+o[b-g]+c;
return(o[b-g]%n+k-h);
default:
if(m1-=e) main(m1-g+e+h,s+g); else *(s+g)=f;
for(*s=a=f;a<e;) *s=(*s<<e)|main(h+a++,(char *)m1);
}
}
C++
--------------------------------------------------------------------------------
Here we have an old version ...
#include <iostream.h>
main()
{
for(;;)
{
cout << "Hello World! ";
}}
... and a more modern one!
#include <iostream>
int main()
{
std::cout << "Hello, world!\n";
}
COBOL
--------------------------------------------------------------------------------
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. HELLOWORLD.
000300 DATE-WRITTEN. 02/05/96 21:04.
000400* AUTHOR BRIAN COLLINS
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.
Fortran
--------------------------------------------------------------------------------
c
c Hello, world.
c
Program Hello
implicit none
logical DONE
DO while (.NOT. DONE)
write(*,10)
END DO
10 format('Hello, world.')
END
Java
--------------------------------------------------------------------------------
class HelloWorld {
public static void main (String args[]) {
for (;;) {
System.out.print("Hello World ");
}
}
}
JavaScript
--------------------------------------------------------------------------------
<TITLE>
Hello World in JavaScript
</TITLE>
<SCRIPT>
document.write ("Hello, world!")
</SCRIPT>
Mathematica
--------------------------------------------------------------------------------
While[True, Print["Hello, world!"]]
Pascal
--------------------------------------------------------------------------------
Program Hello (Input, Output);
Begin
Writeln ('Hello World!');
End.
Perl
--------------------------------------------------------------------------------
print "Hello, World!\n" while (1);
python
--------------------------------------------------------------------------------
while (1) :
print "Hello World";
QBASIC
--------------------------------------------------------------------------------
begin:
print "Hello World!"
goto begin
Smalltalk
--------------------------------------------------------------------------------
Transcript show:'Hello World';cr
Visual Basic
--------------------------------------------------------------------------------
Private Sub FOrm_Load()
Static I
I = 1
for I = 1 to 10
msgbox "Hello World"
Next I
end sub
VRML
--------------------------------------------------------------------------------
#VRML V1.0 ascii
AsciiText {
string "Hello, World!"
justification LEFT
}