Which version of the program is better?
It is not clear that one is better than the other. Part of the challenge of programming is that usually there are many equally good ways to do something (and many bad ways).
Here is a program that writes out a row of stars:
' Print NUM stars in a row LET NUM = 10 PRINT FOR STARS = 1 TO NUM PRINT "*"; NEXT STARS ' END
Here is what the program prints. There are 10 stars, all on one line.
**********
NUM
is the number of stars printed in the line.
The PRINT
statment above the FOR
starts a new line.
It prints "nothing" on a line, then moves on to the next.
The semicolon at the end of the other PRINT
statement
keeps all of its output on one line.
Now say that you wanted to write FIVE LINES, each line consisting of ten stars. How could you do this? (Just think about how the program would look.)