Introduction to Programming for Laymen

sarkinen.com > johan > Teaching > Programming

7. hello, world - Your First Program

< 6. Tools - Editors, Compilers, ... 8. Programming Constructs >

What is 'hello, world'?

This small and simple program presents a short text when executed and is very useful for multiple reasons.

Examples

Example 1: First known (1972)         Example 2: Modern, standard-conforming, C
main( ) {
   extrn a, b, c;
   putchar(a); 
   putchar(b); 
   putchar(c); 
   putchar('!*n');
}
a 'hell';
b 'o, w';
c 'orld';
#include <stdio.h>
 
int main(void)
{
    printf("hello, world\n");
    return 0;
} 
Example 3: In PHP   Example 4: In JavaScript
  echo "hello, world";

document.write('hello, world');

The first known from 1972 is from Brian Kernighan's Tutorial Introduction to the Language B (a predecessor to C).

As you can see, the syntax varies a lot between the different languages.

Learning programming languages means learning not only the specific syntax but also what libraries are available. You certainly don't want to write everything from scratch, but reuse other programmers' code as much as possible.

Try for Your Self

Ok, enough of reading - let's to some practicing! Remember - learning by doing.

  1. If not already opened, open the Workbench 3L - Your Personal Lab
  2. Write your program in the left text area
    document.write('hello, world');
  3. Press button to execute (run) your code
  4. If you see 'hello, world' in the output area, you've successfully executed your first program. Congratulations!

Debugging, Troubleshooting

If you don't see 'hello, world':

References


< 6. Tools - Editors, Compilers, ...8. Programming Constructs >
Updated 2013-01-05

sarkinen.com | Personnel | Businesses | General/Adm | webmaster | J&P Group (JandP.biz)
Copyright © 1999-2016 J. Sarkinen. All rights reserved.