Let's consider a QBasic solution to FizzBuzz. The code works correctly, printing the required output from 1
all the way up. The problem is, since there's a lot of output, some of it scrolls off the screen. What you see when you run the program is this:
Fizz
79
Buzz
Fizz
82
83
Fizz
Buzz
86
Fizz
88
89
FizzBuzz
91
92
Fizz
94
Buzz
Fizz
97
98
Fizz
Buzz
Press any key to continue
Unlike with C and its descendants, output is not a stream, but is sent directly to the screen. This means that 1) you can't scroll back in the terminal and see the previous lines, and 2) you can't redirect output to a file to save the lines.1 Once they scroll off the screen, they're gone.
So is this a valid FizzBuzz program, if it doesn't observably display all 100 lines?
If not, does it help to add a 1-second pause or wait for user keypress after printing each line?
1 Erik the Outgolfer informs me that redirecting output to a file is possible when running QBasic in DOSBox (or in actual DOS, presumably). So that takes away the specific example I used here. I think the general question is still good to ask and might apply in some cases--for example, if LOCATE
is used, as this isn't recorded in the output buffer.
WIDTH
command that lets you set the width and height (in characters) of the display, but there's a limited number of options. The width can be either 80 or 40. About the height, the help file says, "The value can be 25, 30, 43, 50, or 60, depending on your display adapter and screen mode." So it seems to be partially system-dependent, but in any case never enough lines for a full FizzBuzz. \$\endgroup\$