How can i Use and in a select case statement? this won't work:
Select True
n=len(command$)
Case command$=Left$("title",x) and n>2
;do case stuff
There's nothing syntactically wrong with what you have, except the "n=..." line needs to be above the Select statement (and you need an End Select, of course).
This works fine:
command$="title"
n=Len(command$)
Select True
Case command$=Left$("title",5) And n>2
Notify "hi"
Default
Notify "nothing"
End Select
that was a typo accidently, but hrrm it won't work for me, oh well.
Select works somewhat different .. you can not use it in that way
try this !
command$="title"
Select Left$(command$,5)
Case "title"
Notify "hi"
Default
Notify "nothing"
End Select
You can use 'And' - not sure how you want to use it, however:
command$="title of a book"
n=Len(command$)
x=5
n=3; change to 1 to force the second check to be carried out
Select True
Case Left$(command$,x)="title" And n>2
Print "You can do this if n is greater than 2"
Case Left$(command$,x)="title" And n<2
Print "You can do this too if n is smaller than 2"
End Select
Klaas, it's perfectly fine to Select on True -- as long as you make sure your Cases are mutually exclusive (if you want it to work well, that is).
Gauge, the Select and And work fine -- if it's not working, it's your logic. I have no idea what x is, and why you're using Left$ on a constant string ("title"), but the way you have it, it will only be True in these cases:
command$ = "tit" and x = 3
command$ = "titl" and x = 4
command$ = "title" and x = 5