04-12-2003, 10:52 PM
I am having trouble using else in my program.
How can i use else in my program to stop invalid entries.
How can i use else in my program to stop invalid entries.
help with ELSE
|
04-12-2003, 10:52 PM
I am having trouble using else in my program.
How can i use else in my program to stop invalid entries.
04-12-2003, 11:40 PM
(RTFM stuff, blah blah, and such)
IF/THEN/ELSE/ENDIF is used this way: Code: IF <condition> THEN
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio underBASIC, homegrown musicians [img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
04-13-2003, 02:35 AM
But don't forget our handy FM online:
http://qbasicnews.com/qboho/qckif.shtml and http://qbasicnews.com/qboho/qckadvr.ifx.shtml
img]http://usuarios.vtr.net/~disaster/sigs/annoyizer.php[/img]
04-13-2003, 02:57 AM
my program continues to tell me "Else without if". here's the program maybe you can fix it better than i would understand.[/code]
input "Do you want to play a math game"; reply$ if reply$ = yes then goto blahblahblah if reply$ = no then print "O.K.": end else end
04-13-2003, 03:07 AM
Quote:my program continues to tell me "Else without if". here's the program maybe you can fix it better than i would understand.[/code] Code: input "Do you want to play a math game"; reply$
04-13-2003, 06:42 AM
Better yet,
Code: input "Do you want to play a math game"; reply$
04-13-2003, 07:15 AM
Better still:
Code: input "Do you want to play a math game"; reply$ Try to avoid the evil Elseif. My first solution was showing it with a block-if, which was in answer to your question. This is the superior solution.
04-13-2003, 08:51 AM
and just why exactly is "elseif" evil?
04-13-2003, 08:54 AM
i'm not really sure. i use if. select -> end select is certainly a faster way, but it's so insignificant it would matter unless you were pulling this off thousand of times a second.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
04-13-2003, 09:06 AM
ELSEIF is just this:
Code: IF a% = 3 THEN translates to... (faster to write) Code: IF a%=3 THEN I don't see why it is evil, but there is a better form, just like toonski said: Code: SELECT CASE a% You'll only notice the speed increase if, as toonki said, you need to evaluate things in a long loop (for example, in a game loop).
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio underBASIC, homegrown musicians [img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i |
« Next Oldest | Next Newest »
|