Skip to content

Commit

Permalink
Better style in fib.bas
Browse files Browse the repository at this point in the history
  • Loading branch information
davecom committed Dec 4, 2024
1 parent 936ccc0 commit d4fdb9f
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions NanoBASIC/Examples/fib.bas
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
REM Printing the Fibonacci numbers less than 100
REM A is LAST
20 LET A = 0
REM B is NEXT
30 LET B = 1
31 PRINT A
REM C is LAST + NEXT
35 LET C = A + B
40 LET A = B
50 LET B = C
60 IF B > 100 THEN GOTO 80
70 GOTO 31
80 PRINT A
REM A is the last number
10 LET A = 0
REM B is the next number
11 LET B = 1
20 PRINT A
21 PRINT B
REM C is last + next
30 LET C = A + B
31 LET A = B
32 LET B = C
40 IF B < 100 THEN GOTO 21

0 comments on commit d4fdb9f

Please sign in to comment.