[Gambas-user] Merry Christmas and silly problem
Jussi Lahtinen
jussi.lahtinen at gmail.com
Tue Dec 27 00:15:00 CET 2022
Or, if the upper limit is irrelevant:
iv = 10^(ceil(log10(mn))-1)
Jussi
On Mon, Dec 26, 2022 at 4:54 PM Dag JNJ <gambas at cd-bahia.com> wrote:
>
>
> On 26.12.22 12:51, Dag JNJ wrote:
> > Hi and thank you very much Lee and BB
> > I can see my error - shame on me. Only excuse: it was late. 😅
> > Regards Dag
> >
> > On 26.12.22 04:55, BB wrote:
> >>
> >> On 26/12/22 1:12 pm, T Lee Davidson wrote:
> >>> 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]
> >>>
> >>> :-)
> >>> or just
> >> [code]
> >> Select Case mn
> >> Case To 100
> >> iv = 10
> >> Case To 1000
> >> iv = 100
> >> Case To 10000
> >> iv = 1000
> >> Case To 100000
> >> iv = 10000
> >> Default
> >> iv = 10
> >> End Select
> >>
> >> [/code]
> >>
> >> It should just drop out of the select chain on the first true
> >>
> >> b
> >>
> >>
> This one worked fine
>
> [code]
> Select Case mn
> Case To 100
> iv = 10
> Case To 1000
> iv = 100
> Case To 10000
> iv = 1000
> Case To 100000
> iv = 10000
> Default
> iv = 10
> End Select
>
> [/code]
>
> thank you very much!
> Dag
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20221227/11eef3c9/attachment-0001.htm>
More information about the User
mailing list