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 / Problems with multiple IF statements - can someone please help?

Author
Message
Dragon Tycoon
20
Years of Service
User Offline
Joined: 3rd Feb 2004
Location:
Posted: 4th Feb 2004 00:33
I'm trying to figure out how to use multiple if/else statements in my DarkBASIC Professional program. Something along the lines of:



I've looked at the help files and looked int the manual but can't seem to figure it out. Can anyone help?

Thanks in advance.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 4th Feb 2004 01:26
You are missing ENDIFs

However, for your example, look up SELECT / CASE, it's more suited, and will make your code easier to read.

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 4th Feb 2004 01:26
Take a close look, you're missing an END IF statement.



You'll get used to these little details after you program a while.

Crazy Donut Productions

Juvenile Industries
Current Project: KillZone(FPS)
Soon to come:An rts, and a snowball fight game
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 4th Feb 2004 02:13
Oh, and there's no such command as else if like other languages. So you have to have lots of nested if's:



Boo!
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 4th Feb 2004 02:23
Like BatVink said, following code would be better as more readable when you start adding more conditions



Boo!
Dragon Tycoon
20
Years of Service
User Offline
Joined: 3rd Feb 2004
Location:
Posted: 4th Feb 2004 13:44
Thanks, I'll try these and post back.
Dragon Tycoon
20
Years of Service
User Offline
Joined: 3rd Feb 2004
Location:
Posted: 4th Feb 2004 13:50
Thanks guys, now I can actually get somewhere with this! I think I get case and select now, which will make things a WHOLE lot easier, but thanks to everyone for helping.
By the way, Crazy Donut Productions, your code didn't work, and I'm not sure why. Just thought you might want to know.

Thanks again!
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 4th Feb 2004 13:59
Because you cant ELSE IF in DB You can only do what spooky did


We need help! Email us! join@eternaldestinyonline.com
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 4th Feb 2004 14:16
He had a "end if" instead of "endif" and needed two more endifs


Our civilization faces three great dangers. The first is destruction by a nuclear war, the second is being crippled with overpopulation and the third is the Age of Leisure.

Login to post a reply

Server time is: 2024-11-26 03:53:05
Your offset time is: 2024-11-26 03:53:05