Hello World: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Johan Förberg
(Removed picture of the console saying "Hello, world!")
imported>Johan Förberg
(All the examples moved to /Code)
Line 2: Line 2:


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.
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 programming language|C]] ===
<pre>
#include <stdio.h>
int main()
{
    printf("This is my first C program!\n");
    return 0;
}
</pre>
=== Example in [[C%2B%2B|C++]] ===
<pre>
// Hello World in C++ (pre-ISO)
#include <iostream.h>
int main()
{
    cout << "Hello World!" << endl;
    return 0;
}
</pre>
=== Example in Java ===
<pre>
// Hello World in [[Java]]
class HelloWorld {
  static public void main( String args[] ) {
    System.out.println( "Hello World!" );
  }
}
</pre>
=== Example in [[Perl]] ===
<pre>
# Hello world in perl
print "Hello World!\n";
</pre>
=== Example in [[PHP]] ===
<pre>
<?php
  // Hello World in PHP
  echo 'Hello World!';
?>
</pre>
=== Example in [[Python programming language|Python]] ===
<pre>
# Hello World in Python
print "Hello world"
</pre>
=== Example in VBScript ===
<pre>
'Hello World in VBScript
WScript.Echo "Hello world"
</pre>
=== Example in [[Ruby programming language|Ruby]] ===
<pre>
# Hello World in Ruby
puts 'Hello world'
</pre>
=== Example in [[C_Sharp|C#]] ===
<pre>
// Hello World in C#
class Hello
{
  static void Main()
  {
      System.Console.WriteLine("Hello World");
  }
}
</pre>
=== Example in [[Quick Basic]] ===
<pre>
// Hello World in QBasic
CLS
phrase$ = "Hello World!"
PRINT phrase$
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>
=== Example in BASH shell scripting ===
<pre>
#!/usr/bin/bash  #This is the location of your BASH shell
mytext="Hello World!"
echo "$mytext"
</pre>
== Hello World in Other Languages ==
*[[AIML]]
*[[Erlang_programming_language/Tutorials#Examples|Erlang]]
*[[MySQL/Tutorials|MySQL]]
*[[Prolog]]


== See also ==
== See also ==

Revision as of 11:55, 18 July 2010

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.

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.

See also

99 Bottles of Beer

External links

The Hello World Collection in more than 300 programming languages