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 / Select - Case Not working

Author
Message
Ratty Rat
21
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 24th Sep 2002 18:25
I just got the DBPro Demo to see if I want to upgrade from the original DB I bought and the following simple bit of code does not work:-

tx$ = "H"

Select tx$
Case "H"
Print "The value of tx$ is H"
endcase
Case Default
Print "Unable to determine value of tx$"
endcase
endselect

wait key


Obviously it should give the first message but instead it gives the default one, anyone got any ideas whats gone wrong here?
Ratty Rat
21
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 24th Sep 2002 18:38
With a bit of experimenting I found that I can change the first case line to :-
Case left$("H",1)

and it works, which suggests the problem lies with putting string parameters directly in a case statement.
Ratty Rat
21
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 24th Sep 2002 18:45
OK the last post was wrong too, it actually makes it give the first message with any value in tx$

The only way I have round this is to replace the code with IF`s (BLEUGH :-P)
djlaptop
21
Years of Service
User Offline
Joined: 21st Sep 2002
Location:
Posted: 24th Sep 2002 19:04
I can confirm that it behaves this way in the full version as well.

Login to post a reply

Server time is: 2024-04-26 16:59:07
Your offset time is: 2024-04-26 16:59:07