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.

DarkBASIC Discussion / case statement in error???????

Author
Message
ico2
21
Years of Service
User Offline
Joined: 3rd Jan 2004
Location:
Posted: 17th Mar 2004 19:46
when i run a select command "select sprite collision(1,0)" with case statements which i will not bother to write her i get a compiler error: case statement used in error at that line.
ehat does this mean and how can fix it?

thanks
ico2
The Jackal
21
Years of Service
User Offline
Joined: 12th Mar 2004
Location:
Posted: 17th Mar 2004 20:13
i would assume this is coz you have a space between "sprite" and "collision" cases are better used in single worded variables

dats my input

Aj

Now this is the law of the jungle As old and true as the sky
And the wolf that shall keep if may prosper
But the wolf that shall break it must die.
ico2
21
Years of Service
User Offline
Joined: 3rd Jan 2004
Location:
Posted: 20th Mar 2004 00:36
heres another bit of code that is similarly constructed that produces the same error.

LReM8888
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: The Land of the Fairies
Posted: 22nd Mar 2004 22:16
erm... does DB allow selects inside other selects?
John Y
Synergy Editor Developer
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: UK
Posted: 22nd Mar 2004 22:37
I think you have misunderstood the syntax for select statements. Select Statements are made up of a single Select keyword, and finish with the EndSelect keyword. Inside this code block of:

Select variable

EndSelect

You can have as many cases as possible, which are chosen by the value of variable e.g.

Select myVar
Case 1
Rem Some code if myVar is equal to 1
EndCase
Case 2
Rem Some code if myVar is equal to 2
EndCase
EndSelect

From that code you should be able to get it working with your program

Level Maker 3D: www.levelmaker3d.co.uk/levelmaker3D.asp
DarkBasic Professional Editor: www.levelmaker3d.co.uk/ide.asp
also: www.levelmaker3d.co.uk/KrazyKarts/ & www.DigitalOmega.Net
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 24th Mar 2004 06:59
It looks like you want to use select..case like a branching IF statement. I'm kind of asking this question too, does nesting select..case in side other select..case statements generate an error?

Crazy Donut Productions
Current Project: KillZone

Login to post a reply

Server time is: 2025-05-31 17:42:04
Your offset time is: 2025-05-31 17:42:04