next up previous contents
Next: Variables Up: Simple Variables Previous: Simple Variables   Contents

Tedious Counting

Let us assume you have a program that looks like the following:

begin
  writeln(' 1. make breakfast');
  writeln(' 2. send kid to school');
  writeln(' 3. pick up coffee');
  writeln(' 4. go to work');
  writeln(' 5. call dentist');
  writeln(' 6. lunch with spouse');
  writeln(' 7. book ticket to visit parents');
  writeln(' 8. leave work');
  writeln(' 9. pick up kids');
  writeln('10. pick up dinner');
  writeln('11. go home');
end.

Hardly exciting, I know. Now, imagine that you need to insert an item between ``call dentist'' and ``lunch with spouse''. Although it is as easy as inserting one more writeln statement, you have to renumber all the items after ``lunch with spouse''. It'd be nice if somehow the program can automatically count the number of points.

With variables, the program can.



Tak Auyeung 2003-12-03