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 / Still problem with SELECT/CASE

Author
Message
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 21st Oct 2002 23:40
With the following code :

t$=chr$(34)+"u"

rem print mid$(t$,1);" ";chr$(34)
select mid$(t$,1)
case chr$(34) : print "Quote"
endcase
case default : print "Nope"
endcase
endselect
wait key

the 'Quote' line is never printed. Unfortunately to get around this, the REM statement needs to be UNREMmed (for some reason), or mid$ result needs to be assigned to another variable (which is inefficent to say the least).

Still get nasty crashes when trying to export X files (with textures) from Cinema4D - luckily this can be got around by exporting/loading textures seperatly. Unfortunatly, it means I cant use any of the 'build-in' textures.

The number of parameters problem when passed to a DLL (and exepecting a return value) hasn't been fixed.

Nice to see the LINE and INK commands working properly together though
Yes, I really am THAT good...
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 21st Oct 2002 23:53
As an aside, assigning characters to another doesn't always work with SELECT/CASE :

selectTest(chr$(34))
wait key

function selectTest(char as string)
item AS STRING

item=mid$(char,1)
select item
case chr$(34) : print "Correct"
endcase
case default : print "Wrong"
endcase
endselect

endfunction

Wrong is always printed, even though a " is actually passed into the function

Yes, I really am THAT good...
Ratty Rat
21
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 22nd Oct 2002 18:47
For both examples, I can confirm that I get the same effect, incidentally I noticed that the first one works if you assign the 'case' parameter to a variable first, but not the second one.

Ratty Rat
21
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 22nd Oct 2002 20:23
..... or possibly not, it just seems to go to the first one, this example shows the problem occurs even with integers, it always goes to the first case no matter what test is set to, but replace a & b with 1 & 2 and it works fine.

MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 22nd Oct 2002 21:39
Yes, I cant seem to work out when assigning to another variable works...

At least SELECT works with BYTE variables now...

Yes, I really am THAT good...

Login to post a reply

Server time is: 2024-04-25 14:03:19
Your offset time is: 2024-04-25 14:03:19