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 Professional Discussion / Missing Operator in the command "Case"

Author
Message
TheCyborg
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Denmark
Posted: 8th Jun 2003 16:52
In my school I should program an application. I was tied to use case and select and so on.... But the problem is that I cant use bigger than and smaller than operators () in case...

I had to use the same old f#@$king Turbo Pascal as all the other guys in my class, because you CAN use operators in pascal in case...

DBP Example:


Pascal Example:


Why hasn't this been included in DBPro yet???
http://thecyborg.amok.dk/imgs/logob.jpg[/img]
http://thecyborg.amok.dk/
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 8th Jun 2003 17:07 Edited at: 8th Jun 2003 17:09
Yes, its common in BASIC not to be able to use ranges in CASE statements... I very much doubt it will be included (you could always E-Mail Lee about it).

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Jun 2003 17:08
Because it gives you no benefit over the IF statement in DBPro.



Some other languages have a 'jump table' optimisation for case statements, but they don't usually operate on ranges either, because the amount of code memory they would use would be counter productive.
TheCyborg
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Denmark
Posted: 8th Jun 2003 17:18
I know i could use the IF statement, but the essay told me to use the CASE startement....
There was another essay where I should make EXACTLY the same program using IF instead of CASE... That program was almost 3 times as long as the one in case...

MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 8th Jun 2003 17:49
The source code may be three times as long, but the resulting compiled code would probably be more or less the same.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!

Login to post a reply

Server time is: 2026-07-11 11:42:39
Your offset time is: 2026-07-11 11:42:39