Qbasicnews.com

Full Version: Grouping IF's
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Im making a little rpg type thing to practice my qbasic skills and i have a question:

i finding for each room of my rpg i have to write out a repetitive list of IF's eg:
Code:
If a$ = "look" THEN .....
if a$ = "stand" THEN ....
if a$ = "stand" THEN ...
if a$ = "sleep" THEN ...

such commands are common to each room and all have the same effect but i want to be able to tidy the code up by being able to recall all those if commands using one small command that refers to that particular group of IFs, but im not sure how to do this?
can anyone help?
:???:
.
Use subroutines, GOSUB and RETURN. Look in QB help about those.
Hey Na_tH_an (I don't have the QBHELP handy... I guess I could go to the website qbasicnews but I'm too lazy and I got to go soon) does the GOSUB/RETURN commands ... hmm, does it go to a certain sub and then automatically return back to where the GOSUB command was issued?
Yes.
Thanks :wink: