Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / help with "if" command

Author
Message
Plastico
20
Years of Service
User Offline
Joined: 3rd May 2004
Location:
Posted: 23rd Aug 2004 09:55
what I want to achieve is this. when the program prints f$(4) I want my program to repeat the question. and when the program prints f$(3) I wnat it to move on to the next question.

this is for a text game im making that simply shows you a picture and you have to idenify it.

JokerZ
AGK Silver Backer
20
Years of Service
User Offline
Joined: 2nd Jul 2004
Location: Perth, Western Australia
Posted: 23rd Aug 2004 10:34 Edited at: 23rd Aug 2004 10:35
If you didn't mind breaking the program flow a little,
you could always use a goto command to go back up to the top of the loop.



Many people don't like the use of goto. Personally, I'm old school and I'll use
it if I need to make a break every now and then.

Everything happens for a reason
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 23rd Aug 2004 11:08
Alternatively, if you want to avoid the dreaded goto loop, (although personally I can't see any problem with it as used above), you would probably use the repeat-until loop. Something like this I think....




Plastico
20
Years of Service
User Offline
Joined: 3rd May 2004
Location:
Posted: 23rd Aug 2004 16:08
much thanks, I actually dont mind using "goto" I just treat it like any other command. I prefer it more than loops for smaller programs such as this.
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 24th Aug 2004 16:38
Dont use goto!! Use gosub


Check out our Team Request in the Team Request section if you want to help!
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 24th Aug 2004 17:37
I know we're in danger of starting a whole new 'GOTO' or 'DON'T GOTO' thread - but......

Sure - if you want to run a subroutine and return back to the same place, use gosub But if you don't wish to return, then you would use goto. Like a re-entry point in the program where a user wants to restart - that's where I'd use a goto, to take them back to a previous part of the program.


Login to post a reply

Server time is: 2024-11-27 07:35:55
Your offset time is: 2024-11-27 07:35:55