[Gambas-user] static const?
Doriano Blengino
doriano.blengino at ...1909...
Thu Apr 15 00:20:41 CEST 2010
Errata corrige:
>>
>>
>>> Finally, your last lines of code do not work:
>>>
>>>
>> Yes, it works.
>>
>>
>>
>>>> PRIVATE FUNCTION ScanTab(IdCaption AS String) AS Byte
>>>> DIM a AS Byte = 0
>>>>
>>>> WHILE (a< TabStrip1.Count - 1) AND (TabStrip1[a].Text<> IdCaption)
>>>> INC a
>>>> WEND
>>>>
>>>> RETURN IF(TabStrip1[a].Caption = IdCaption, a, -1)
>>>> END
>>>>
>>>>
>>
>>
>>> The third cycle does not get executed - "a" is 2, which is not less than
>>> "3-1" (it is equal).
>>>
>>>
>> That's irrelevant because the external comprobation (the logical
>> expression in the return sentence)
>>
>>
> May be that I am missing something, but... how can you say that it works
> if it omits to test the last item?
>
Time later, driving to home and still thinking about this routine, I
finally recalled what you wanted to say with "comprobation".
Yes, you are right - your code works. If I would have payed more
attention to the routine, I would have noticed. But, stupidly, I
concentrated only on the cycle, noting that it was missing a test on the
last item. That last item is managed by the last test before exiting.
Still I don't like this routine. What happens if TabStrip1.Count=0
(emtpy tabstrip)?
Ok, now I'am home, it's late - so good night to everybody (in Europe, of
course).
Regards,
--
Doriano Blengino
"Listen twice before you speak.
This is why we have two ears, but only one mouth."
More information about the User
mailing list