| CHAPTER 3 Making programs that do more than nothing |
|||||||||||||||||||
| You will now be blown back by the following. Put on your thinking caps, thinking shirts, thinking trousers,thinking blouse, etc. ; |
|||||||||||||||||||
| This will be used alot in almost any program. IF - THEN - ELSE - END IF is something you can't do without. Look at this properly and make sure you understand what is going on. |
|||||||||||||||||||
| x = 100 | |||||||||||||||||||
| IF x => 100 THEN PRINT "x is equal or more than 100" ELSE PRINT "X is less than 100" END IF |
|||||||||||||||||||
| Note: If you don't use ELSE you needn't type down END IF. | |||||||||||||||||||
| What if you want to make a menu? You could use the almighty IF command, but it could get tedious. Don't condemn QBASIC yet, for here comes our great hero, the SELECT - END SELECT command.Examine this.(Sorry I can't explain it but it's too hard to.) ; |
|||||||||||||||||||
| PRINT "1.Erase everything" 'Printing the options PRINT "2.Type down QBASIC RULES!" PRINT "3.End this program" |
|||||||||||||||||||
| INPUT "What is your choice, Grand Poobah?", choice 'Asking for the option they want.; | |||||||||||||||||||
| SELECT CASE choice CASE IS = 1 'Option 1 was chosen CLS CASE IS = 2 ' Option 2 was chosen CLS PRINT "QBASIC RULES" CASE IS = 3 CLS PRINT "BYE!" END END SELECT |
|||||||||||||||||||
| Pretty neat, huh ? Don't understand ? Puzzled ? Stress ? Review this, and it might make sense(a little). |
|||||||||||||||||||
| Now, say you are happy with me coz' that is the end of the tutorial(Chapter 3) | |||||||||||||||||||
| P.S : Note my nice logo at the bottom, left. | |||||||||||||||||||
![]() |
|||||||||||||||||||