© Gerald Friedland 2019
Gerald FriedlandBeginning Programming Using Retro Computinghttps://doi.org/10.1007/978-1-4842-4146-2_12

12. Counting

Gerald Friedland1 
(1)
Berkeley, CA, USA
 

It’s time you give the computer a lot more work! For example, let’s make the computer count for you. This chapter introduces FOR and NEXT.

Make sure you are at the startup screen. Type the following:

10 FOR I=1 TO 10 (press RETURN)

20 PRINT I (press RETURN)

30 NEXT I (press RETURN)

Type RUN and press RETURN to start the program.

../images/470770_1_En_12_Chapter/470770_1_En_12_Figa_HTML.jpg

How does this work?

Line 10 says this:

FOR I=1 TO 10

The variable called I is set to 1 with I=1. So, I=1. Let’s skip the other stuff for now.

Line 20 says ...

Get Beginning Programming Using Retro Computing: Learn BASIC with a Commodore Emulator now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.