The first program to write is the same for all languages:
Print the words hello, world
This is the big hurdle; to leap over it you have to be able to create the program text some-
where, compile it successfully, load it, run it, and find out where your output went.
With these mechanical details mastered, everything else is comparatively easy.
— KERNIGHAN & RITCHIE, The C Programming Language (1988)
A Procedure for Progressing
> Inputs: You 1.0; the set of all programming languages; this
exercise; the set of exercises containing this exercise.
< Result: You 2.0 (a side effect).
Step 00. Initialize. Let N <- 0. If this is the first exercise:
if you don't know any languages, then select one;
otherwise, choose yet another language.
Step 01. Really try. If N > 0, then try this exercise.
Step 02. RTFM. Read the fascinating manuals.
Step 03. Happy? If happy with results, then peek at hints;
otherwise, go to Step 07.
Step 04. Still happy? If happy with results and there are more
exercises, then go to the next exercise.
Step 05. Exhausted? If happy with results and there are not more
exercises, then go back to the first exercise.
Step 06. Expert? If happy with results and there are no more
exercises and there are no more languages, then develop
more exercises or design a new programming language.
Step 07. Increment. N <- N + 1.
Step 08. Keep trying. If N < 3, then go to Step 01.
Step 09. Peek. Peek at the next hint if there are more hints.
Step 10. GIYF. If there are no more hints, then search for help.
Step 11. Repeat. Go to Step 01.
/* Start with a public class. */
public class HelloWorld
{
}
public class HelloWorld
{
/** A Java program must have a main method.
*/
}
public class HelloWorld
{
/** This is what a main method looks like.
*/
public static void main(String[] args)
{
// Use System.out.print and/or System.out.println.
}
}
// Hello World in JavaScript can be a single statement.
// You have several options when using JavaScript.
// Evaluate a string, call alert, call console.log, etc.
/* You can create and call your own function. */
function output(someText) {
// Finish me.
}
output("hello, world\n");
/** You can mimic Java.
*/
const System = {
out: {}
};
System.out.println = function(someText) {
// Finish me.
};
System.out.println("hello, world");
Programming Language
Instructions
Print the words hello, world.
Scratchpad
eval output:
Good Stuff
Initialisms similar to RTFM include "STFW" [...], "GIYF" ("Google is your friend") and "LMGTFY" ("let me Google that for you").
These indicate that the questioner could have easily found the answer to their question on the World Wide Web.
— English Wikipedia, “RFTM” (accessed on 13 Oct 2018)
The exercises in this set of books have been designed for self-study as well
as for classroom study. It is difficult, if not impossible, for anyone to learn a
subject purely by reading about it, without applying the information to specific
problems and thereby being encouraged to think about what has been read.
Furthermore, we all learn best the things that we have discovered for ourselves.
[...]
Solutions to most of the exercises appear in the answers section. Please use
them wisely; do not turn to the answer until you have made a genuine effort to
solve the problem by yourself, or unless you absolutely do not have time to work
this particular problem. AFTER getting your own solution or giving the problem a
decent try, you may find the answer instructive and helpful.
[...]
When working an exercise you may generally use the answers to previous exercises,
unless specifically forbidden from doing so.
— DONALD E. KNUTH, The Art of Computer Programming (1997)