[Gambas-user] Merry Christmas and silly problem
T Lee Davidson
t.lee.davidson at gmail.com
Mon Dec 26 03:42:37 CET 2022
On 12/25/22 19:29, Dag JNJ wrote:
> First now I got my PC to run again with Matte 22.04.1 and put the settings ok. Installed the latest version of Gambas 3.16.3
> from the repository
>
> |sudo add-apt-repository universe sudo apt update (even if add repository makes this now) sudo apt install gambas3 |
>
>
> with no error.
>
> The silly problem looks like this:
> /
> // Select Case mn//
> // Case mn <= 100//
> // iv = 10//
> // Case mn <= 1000//
> // iv = 100//
> // Case mn <= 10000//
> // iv = 1000//
> // Case mn <= 100000//
> // iv = 10000//
> // Default //
> // iv = 10//
> // End Select
> stop
>
> /mn has the value 530, so iv should be 100. iv is for interval. mn is max number.
> It always get the default value 10. I have a halt at select case, so I followed the single steps.
> And made
> /?//mn <= 100//(=false, correct)
> ? ///mn <= 1000//(=true, also correct)
> //
> The iv=100 should have been taken, I simply can't see why not.
Your syntax is wrong in the Case statements. Try:
[code]
Select Case mn
Case 0 To 100
iv = 10
Case 101 To 1000
iv = 100
Case 1001 To 10000
iv = 1000
Case 10001 To 100000
iv = 10000
Default
iv = 10
End Select
[/code]
Or, the way I think you were actually wanting to make it work:
[code]
Select Case True
Case mn <= 100
iv = 10
Case mn <= 1000
iv = 100
Case mn <= 10000
iv = 1000
Case mn <= 100000
iv = 10000
Default
iv = 10
End Select
[/code]
:-)
--
Lee
More information about the User
mailing list