Hello World!

Any other programming language that is not covered in the Web Scripting category.

Hello World!

Postby hawking on Thu Aug 25, 2005 8:00 am

Hello World is the first programme one writes when learning a new language.
Below is a list of Hello World programmes:
I am sure this is helpful for comparing different programming languages.
~~~~~~~~~~
Ada
with Ada.Text_IO;

procedure Hello_World is
begin
Ada.Text_IO.Put_Line ("Hello World!");
end Hello_World;

[edit]
AppleScript
display dialog "Hello World!"

~~~~~~~~~~
ASP
response.write "Hello World!"

~~~~~~~~~~
Assembler (DOS)
.MODEL SMALL
.DATA
HWRLD DB "Hello world!$"
.CODE
MOV AX,@DATA
MOV DS,AX
MOV DX,OFFSET HWRLD
MOV AH,09H
INT 21H
POP DX
POP AX
MOV AH,4CH
INT 21H
END

~~~~~~~~~~
BASIC (ANSI) (Also works in FoxPro)
?"Hello World!"

~~~~~~~~~~
BCPL
GET "LIBHDR"
LET START() BE WRITES("Hello, World")

~~~~~~~~~~
C (ANSI)
#include <stdio.h>

int main() {
printf("Hello World!\n");
return 0;
}

~~~~~~~~~~
C#
using System;

namespace HelloWorld
{
public class HelloWorld {
static void Main() {
Console.WriteLine("Hello World!");
}
}
}

~~~~~~~~~~
C++
#include <iostream>

using namespace std;

int main()
{
cout << "Hello World!" << endl;
return 0;
}

~~~~~~~~~~
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.

~~~~~~~~~~
DOS batch file
echo Hello World!




~~~~~~~~~~
D (DTrace)
#!/usr/sbin/dtrace -qs
BEGIN
{
trace("Hello World!");
exit(0);
}

~~~~~~~~~~
Fortran
WRITE (*,*) "Hello World!"

~~~~~~~~~~
Haskell
print "Hello World!"

~~~~~~~~~~
HTML
<html>
<head><title>Hello world</title></head>
<body>
Hello world
</body>
</html>

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

~~~~~~~~~~
Java Script
<script type="text/javascript">
window.alert("Hello World!");
</script>

~~~~~~~~~~
JSP
<%= "Hello World!" %>

~~~~~~~~~~
Lisp
(DEFUN HELLO-WORLD ()
(PRINT (LIST 'Hello 'World!)))

[edit]
Objective-C
#import <objc/objc.h>

int main (int arg, char **args) {
NSLog(@"Hello World!");

return 0;
}

~~~~~~~~~~
Parrot Assembler
print "Hello World!\n"
end

~~~~~~~~~~
Pascal
Begin
Writeln('Hello World!');
End.

~~~~~~~~~~
Perl
#!/usr/bin/perl
print "Hello World!\n";

[edit]
PHP
<?php
echo "Hello World!\n";
?>

~~~~~~~~~~
Python
#!/usr/bin/env python
print "Hello World!"

~~~~~~~~~~
QuickBASIC
PRINT "Hello World!"

~~~~~~~~~~
Ruby
#!/usr/bin/ruby
puts "Hello World!"

~~~~~~~~~~
Scheme
(display "Hello World")
(newline)

~~~~~~~~~~
Shell script (Bourne)
#!/bin/sh
echo 'Hello World!'

~~~~~~~~~~
Shell script (C)
#!/bin/csh
echo 'Hello World!'

~~~~~~~~~~
SPARK
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;

~~~~~~~~~~
Tcl
#!/usr/bin/tclsh
puts "Hello World!"

~~~~~~~~~~
TI BASIC
isp "Hello, World"

or

:ClrHome
isp "Hello, World"
Razzause
:ClrHome
:Output(1,1,"")

or even

:ClrHome
:Output(1,1,"Hello, World")
Razzause
:ClrHome
:Output(1,1,"")

~~~~~~~~~~
Tk
#!/usr/bin/wish
frame .top -borderwidth 10
pack .top -fill x
label .top.hi -text "Hello World!"
pack .top.hi -side left -padx 0p -pady 0

~~~~~~~~~~
Visual Basic
VBA.Interaction.MsgBox "Hello World!"

~~~~~~~~~~
Windows 32-bit Assembly
MASM:

.data
szHello db "Hello World",0
.code
push 0
push 0
push offset szHello
push offset szHello
push 0
call MessageBoxA
call ExitProcess
end
~~~~~~~~~~
hawking
Newbie
Newbie
 
Posts: 2
Joined: Thu Aug 25, 2005 7:55 am

Postby DeeBG on Sun Aug 28, 2005 3:19 am

And just for any sadist out there who wants more, Wikipedia provides a good list of "Hello World" examples from an even wider sampling of languages here.
DeeBG
Contributer
Contributer
 
Posts: 46
Joined: Wed Aug 10, 2005 3:10 am

re

Postby sasho_metala on Tue Sep 06, 2005 12:08 am

You missied HTML Wink))))))
sasho_metala
Newbie
Newbie
 
Posts: 13
Joined: Mon Sep 05, 2005 10:44 pm
Location: Bulgaria

Postby goncalopp on Thu Sep 08, 2005 10:42 pm

Although HTML is a language, I don't think it is considered a programming language. You can't make programs with HTML (please correct me if I'm wrong, I'm not an "HTML programmer" Wink )
goncalopp
Newbie
Newbie
 
Posts: 7
Joined: Thu Sep 08, 2005 10:25 pm
Location: Student

Postby C on Sat Sep 10, 2005 10:05 am

you forgot VB6. you only gave an .net example.
some VB programmers religiously oppose the .net and the heaviness of the framwork and the useless sadistic learning curve. So here we go:

private sub cmd_click()
msgbox("Hello world!")
end sub
-=-=| wolfinux |=-=-
C
Contributer
Contributer
 
Posts: 21
Joined: Sat Sep 10, 2005 6:04 am

Postby beetleflux on Sat Sep 10, 2005 5:06 pm

That was a great list of hello world in different languages. Very Happy
beetleflux
Newbie
Newbie
 
Posts: 14
Joined: Sat Sep 10, 2005 4:57 pm
Location: Norway

Postby emb92 on Tue Sep 13, 2005 11:55 pm

Yeah, very nice list Laughing . It's good for seeing the basic language if you're learning it Smile .
emb92
Contributer
Contributer
 
Posts: 25
Joined: Mon Sep 12, 2005 6:04 am

Postby mm_freak on Wed Sep 14, 2005 12:21 am

I don't like the C example. Here is a better one:

Code: Select all
#include <stdio.h>

int main() {
  puts("Hello world!");
  return 0;
}


Or for lonely people:

Code: Select all
#include <stdio.h>

int main() {
  int err;

  err = puts("Hello world!");
  if (err != EOF) return 0;
  perror("puts");
  return 1;
}


Edit: Also the DOS assembler example is really bad! Even the program's return value is undefined. But nevermind. DOS is dead. =)
I'm x^10 + x^8 + x^5 + x^4 + x^3 + 1, so don't mess with me!
mm_freak
Moderator
Moderator
 
Posts: 635
Joined: Sun Sep 11, 2005 12:29 pm
Location: Baden-Wuerttemberg (Germany)

Postby thebeast on Thu Sep 15, 2005 12:52 pm

Nice one to read is very interesting how to program in different languages Hello World :-) In this year of study i'll learn how to program in Assembler becouse i'll must prepeare a course project whit some microprocessor which is programable whit assembler :-)
Sarunas B.
Phoenix Network Still Alive!
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(" )_(" ) signature to help him gain world domination.
thebeast
Phoenix Veteran
Phoenix Veteran
 
Posts: 646
Joined: Wed Mar 23, 2005 1:20 pm
Location: Lithuania

Since I cannot be bothered to copy/paste all of these

Postby merliin on Sat Sep 17, 2005 5:58 pm

Here is the link to a LARGE collection of hello world snippets.
http://www.roesler-ac.de/wolfram/hello.htm

MERLiiN
merliin
Newbie
Newbie
 
Posts: 13
Joined: Mon Sep 12, 2005 2:26 am
Location: Melbourne, Australia

Postby thebeast on Mon Sep 19, 2005 12:07 pm

And DOS is not dead becouse i need to prepeare a some microchip and program it with assebler for my course project :-)
Sarunas B.
Phoenix Network Still Alive!
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(" )_(" ) signature to help him gain world domination.
thebeast
Phoenix Veteran
Phoenix Veteran
 
Posts: 646
Joined: Wed Mar 23, 2005 1:20 pm
Location: Lithuania

Postby mm_freak on Tue Sep 20, 2005 4:59 am

thebeast wrote:And DOS is not dead becouse i need to prepeare a some microchip and program it with assebler for my course project :-)


What does that have to do with DOS?
I'm x^10 + x^8 + x^5 + x^4 + x^3 + 1, so don't mess with me!
mm_freak
Moderator
Moderator
 
Posts: 635
Joined: Sun Sep 11, 2005 12:29 pm
Location: Baden-Wuerttemberg (Germany)

Postby thebeast on Tue Sep 20, 2005 4:46 pm

With nothing to do, but i'll need do program some microchip wich is only programable with assembler :-)
Sarunas B.
Phoenix Network Still Alive!
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(" )_(" ) signature to help him gain world domination.
thebeast
Phoenix Veteran
Phoenix Veteran
 
Posts: 646
Joined: Wed Mar 23, 2005 1:20 pm
Location: Lithuania

Postby mm_freak on Wed Sep 21, 2005 10:43 pm

So DOS keeps being dead. =D
I'm x^10 + x^8 + x^5 + x^4 + x^3 + 1, so don't mess with me!
mm_freak
Moderator
Moderator
 
Posts: 635
Joined: Sun Sep 11, 2005 12:29 pm
Location: Baden-Wuerttemberg (Germany)

Postby nene on Thu Sep 22, 2005 4:30 pm

mm_freak wrote:So DOS keeps being dead. =D


not quite... Very Happy
i was doing my final exams at school where I also had to program some batch programs. when you know a little bit of programming languages its just funny to "programm" in DOS edit... Very Happy
Image
nene
Regular
Regular
 
Posts: 128
Joined: Wed Apr 13, 2005 10:24 am
Location: Slovenia

Next

Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron