Hello, world!

From Wikiversity
Jump to: navigation, search
HelloWorld.svg

As described in more detail in the related Wikipedia article, Hello, world! is a classic "first program" one creates when learning a new programming language. The objective of the application is the same: to print the text "Hello, world!" to the screen in some form, be it console output or a dialog.

In many cases, the statement required to do this is a single line.

It seems appropriate that our introduction to Computer Science occupied this title. As a student, the first choice to make is to decide what kind of knowledge you are looking for. Of course, this depends upon your needs. You might be:

  • A learned computer scientist or professional eager to contribute research and course material
  • Computer professional seeking an alternative to expensive commercial certification
  • Adult non-computer professional or entrepreneur who could benefit from academic/practical knowledge of computing
  • College-eligible (or not) student considering a degree
  • Casual user trying to to catch/spread the next virus
  • Hobbyist or computer gamer looking to get the most out of your computing experience
  • Complete newbie looking for a place to start

This is an exciting time for education, and for those of us wishing to collaborate and share knowledge, skills and experience. At present, we are only limited by the sky, and some very large hard drives in a server farm somewhere.

Assignment[edit]

Create a Hello, world! program in a language not listed above, then edit this page and add it to the collection.

Visual Basic .NET[edit]

Module Module1
 
    Sub Main()
        Console.WriteLine("Hello, world!")
    End Sub
 
End Module

C[edit]

Because the tradition of using the phrase "Hello, world!" as a test message was influenced by an example program in the seminal book The C Programming Language.[1] that original example is reproduced here.

#include <stdio.h>

main( )
{
        printf("hello, world\n");
}

The Wikiversity course on the C programming language provides instruction on running this program.

LOLCODE[edit]

 HAI
 CAN HAS STDIO?
 VISIBLE "Hello world!"
 KTHXBYE

Natural [edit]

WRITE 'Hello, world!'
END

Hello, world!

XML[edit]

<?xml version="1.0"?>
<hello>
<messagename="Hello" />
<message>
Hello, World!
</message>
</hello>

Or with attributes:

<?xml version="1.0"?>
<hello messagename="Hello, World!">
Hello, world!
</hello>

MACRO-11[edit]

        .TITLE  HELLO WORLD
        .MCALL  .TTYOUT,.EXIT
HELLO:: MOV     #MSG,R1 ;STARTING ADDRESS OF STRING
1$:     MOVB    (R1)+,R0 ;FETCH NEXT CHARACTER
        BEQ     DONE    ;IF ZERO, EXIT LOOP
        .TTYOUT         ;OTHERWISE PRINT IT
        BR      1$      ;REPEAT LOOP
DONE:   .EXIT

MSG:    .ASCIZ /Hello, world!/
        .END    HELLO

More about Computer Programming[edit]

See also[edit]

Wikipedia-logo.png Wikipedia has more about this subject: Hello world program

External links[edit]