Your First BBC Basic Programs - Tutorial 002
FOR...NEXT loops and use of simple PRINT satements
Work through the following small programs as follows
- Print out this page (if a printer is available)
- Type the first program into the "BBC Basic for Windows" MAIN WINDOW
- Run the program by clicking on the arrow key or by clicking on "Run"
- Edit the program to update it to the next one! Run again and see the effect of the changes you have made.
By observing the effect of these small changes you will soon learn
to write your own programs.....
MODE8
FOR n=1 TO 40
PRINT n
NEXT
MODE8
FOR n=1 TO 40
PRINT n;
NEXT
MODE8
FOR n=1 TO 20
PRINT n,2*n
NEXT
MODE8
PRINT"Squares"
FOR n=1 TO 10
PRINT n, n^2
NEXT
MODE8
PRINT"Square Roots"
FOR n=1 TO 10
PRINT n, SPC(5); SQR(n)
NEXT
MODE8
PRINTTAB(15)"Square Roots"
PRINT
FOR n=1 TO 10
PRINT n, SPC(15); SQR(n)
NEXT
MODE8
PRINTTAB(15)"Square Roots"
PRINT
FOR n=10 TO 100 STEP 10
PRINT n, SPC(15); SQR(n)
PRINT
NEXT
For more info on the use of the PRINT statement,
see the BB4W (BBC Basic for Windows) "Help" available on the Editing Window.
(For the present you may prefer to leave that for later as there may be
more detail there than you need at the moment).
Next Tutorial
Richard Weston's Homepage