I'd like to do ranges without using if/then, ie: (VB6)
temp is a float
B4X:select case temp case 0 case is > 2 and < 4 end select
select case temp
case 0
code here for 0
case <=2
no code here so select is exited for <= 2
case < 4
code here for > 2 and < 4
end select
Only way I know is to use if then.... Else if blocks
Regards, Ricky
Why not do something like:
B4X:select case temp case 0 code here for 0 case <=2 no code here so select is exited for <= 2 case < 4 code here for > 2 and < 4 end select
Dim tmp As Float
Dim Itmp As Int
Itmp=Floor(tmp)
Select Itmp
Case 0 'handles 0 to 0.99
Msgbox("Case 0 to 0.99. Your number is: " & tmp ,"")
'Do this
Case 1 'handles 1 to 1.99
Msgbox(" Case 1 to 1.99. Your number is " & tmp ,"")
'Do the other
Case 2,3 'handles 2 to 3.99
Msgbox("Case 2 to 3.99. Your number is " & tmp ,"")
'Do that
Case Else 'handles 4 and above
Msgbox("Case 4 and above. Your number is: " & tmp ,"")
'Do something else
End Select