Chapter II.2. Variables, Data Types, and Constants

Every program consists of a list of instructions that tell the computer what to do. The simplest program consists of a single instruction, such as one that tells the computer to display the words, Hello, world! on-screen.

Of course, any program that does the same thing over and over again isn't very useful or interesting. What makes a program useful is when it can accept information from the outside world and then respond to that information.

So instead of just displaying Hello, world! on-screen, a more useful program might ask for the user to type his name in so the program could display Hello, Bob!

Programs don't always have to get information from a person. Sometimes, programs can retrieve data that's stored somewhere else, such as a list of employees stored on another computer.

That program could access this database over a network and determine which person has been assigned to which computer in the building. Then the program can retrieve each person's name so when he turns on the computer, the program displays his name on his screen.

An even more sophisticated program could work with a Web cam hooked up to the computer along with a database that includes employee names and their photographs. So every time any computer's Web cam spots someone sitting at the computer, the program could examine the person's image through the Web cam, compare that image to the photographs of all employees stored in the database, and then find the name ...

Get Beginning Programming ALL-IN-ONE DESK REFERENCE FOR DUMMIES® now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.