Sunday, 2018-11-18, 1:47 PM

Welcome Guest | RSS

Qbasic Home

Catalog categories
Qbasic Tutorial [31]

Rate my Site
Rate JPSor Site
Total of answers: 159

Main » Articles » Qbasic Tutorial

Chapter 13 - Qbasic Tutorial

Back in Chapter 4 we saw a DO...LOOP that went forever. There are a number of ways to make a loop stop. One way is to use WHILE. This next program uses WHILE to make sure the program will only go as long as Answer$ has the letter "y" in it.

INPUT "Enter the first number: ", A
INPUT "Enter the second number: ", B
PRINT "The answer is: "; A * B

INPUT "Would you like to do it again (y/n)? ", Answer$
LOOP WHILE Answer$="y"

The condition on the LOOP WHILE line is the same as a condition we might use in an IF...THEN. In this case, we check to see if Answer$="y", and if it does, we continue looping. If it doesn't, we fall out of the loop and our program ends.

You can add this feature to any program. Try adding it to the fortune teller.

Category: Qbasic Tutorial | Added by: JPSor (2009-02-26) | Author: JPSor
Views: 1156 | Rating: 5.0/1 |

Qbasic Clock


Visit my Friends

Who's Online

Total online: 1
Guests: 1
Resgistered: 0

Copyright MyCorp © 2018