Hi:
Anybody could explain me how to use the condition "Select ... Case?
Could you give me a small sample code please?
Many thank you very much. Adios.
How is the condition "Select ... Case?
Re: How is the condition "Select ... Case?
Code: Select all
variable = 3
Select variable
Case 1
Print "It's one"
Case 2
Print "It's two"
Case 3
Print "It's three"
Case 4
Print "It's four"
Default
Print "It's something Else than 1, 2, 3 Or 4"
EndSelect
WaitKey
Re: How is the condition "Select ... Case?
And you can use many parameters within one Case, using ',' as separator.
Example with strings and multiple choises in one Case:
By the way, Constants wont work with Select...Case, does anyone know why
? Try it:
Example with strings and multiple choises in one Case:
Code: Select all
Dim variable As String
variable = "B"
Select Lower(variable) //Make the comparation use only lowercase letters
Case "coolbasic"
Print "It's CB!"
Case "a", "b", "c", "d"
Print "It's a, b, c or d"
Default
Print "It's not anything I know"
EndSelect
WaitKey
![Sad :(](./images/smilies/icon_e_sad.gif)
Code: Select all
Const Constant = 2
variable = 2
Select variable
Case Constant
Print "It's " + Constant
Default
Print "It's not " + Constant
EndSelect
WaitKey
Re: How is the condition "Select ... Case?
Thank You!!!