Hello World: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Alexander Wiebel
(→‎Example in C: linkfix)
imported>Joshua Beckerman
Line 91: Line 91:
PRINT phrase$
PRINT phrase$
END
END
</pre>
=== Example in [[Actionscript]] ===
<pre>
// Hello World in Actionscript
trace("Hello World!")
</pre>
=== Example in [[Javascript]] ===
<pre>
// Hello World in Javascript
document.write("Hello World!")
</pre>
</pre>



Revision as of 22:59, 9 August 2008

This article is a stub and thus not approved.
Main Article
Discussion
Related Articles  [?]
Bibliography  [?]
External Links  [?]
Citable Version  [?]
Code [?]
 
This editable Main Article is under development and subject to a disclaimer.
Results of executing a Hello World program in a console on a Linux or Unix system.

A Hello World program, as first introduced in the book The C Programming Language, is a very short program that typically just prints a word or two of output to a console. Such a program is often one of the first programs that a programmer writes when learning a programming language, as it provide's a cursory introduction to the language's syntax and output.

Example in some of the most popular languages

Example in C

#include <stdio.h>

int main()
{
    printf("This is my first C program!\n");
    return 0;
}

Example in C++

// Hello World in C++ (pre-ISO)

#include <iostream.h>

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

Example in Java

// Hello World in Java

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

Example in Perl

# Hello world in perl

print "Hello World!\n";

Example in PHP

<?php
  // Hello World in PHP
  echo 'Hello World!';
?>

Example in Python

# Hello World in Python
print "Hello world"

Example in VBScript

'Hello World in VBScript
WScript.Echo "Hello world"

Example in Ruby

# Hello World in Ruby
puts 'Hello world'

Example in C#

// Hello World in C#
class Hello
{
   static void Main()
   {
      System.Console.WriteLine("Hello World");
   }
}

Example in Quick Basic

// Hello World in QBasic
CLS
phrase$ = "Hello World!"
PRINT phrase$
END

Example in Actionscript

// Hello World in Actionscript
trace("Hello World!")

Example in Javascript

// Hello World in Javascript
document.write("Hello World!")

Hello World in Other Languages

See also

99 Bottles of Beer

External links

The Hello World Collection in more than 300 programming languages