Chapter 13 - Qbasic Tutorial - Qbasic Tutorial - Qbasic Tutorial - ^^JPS^^
Saturday, 2016-12-03, 5:38 PM

Welcome Guest | RSS

MainRegistrationLogin
Qbasic Home

Catalog categories
Qbasic Tutorial [31]

Rate my Site
Rate JPSor Site
Total of answers: 149

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.

 CLS
DO
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.



Source: http://jpsor.ucoz.com
Category: Qbasic Tutorial | Added by: JPSor (2009-02-26) | Author: JPSor
Views: 912 | Rating: 5.0/1 |
Login

Qbasic Clock

Search

Visit my Friends

Who's Online

Total online: 1
Guests: 1
Resgistered: 0


Copyright MyCorp © 2016