[Gambas-user] static const?

Fabián Flores Vadell fabianfloresvadell at ...626...
Wed Apr 14 02:04:19 CEST 2010


2010/4/13 Jussi Lahtinen <jussi.lahtinen at ...626...>:
> Aaa.... I think you meant it this way:
>
> PUBLIC FUNCTION ScanTab(IdCaption AS Integer) AS Integer
> Dim a as Integer
> Dim b as Integer
>
> REPEAT
>   IF TabStrip3[a].Caption = IdCaption THEN
>      b = TabStrip3.Count
>      BREAK
>   ENDIF
> WHILE a < TabStrip3.Count
>
> RETURN b
> END
>
> Jussi

You're getting close. But, I think that is no need to break the loop
using the BREAK sentence. Just you must find the right condition to
the loop.

I don't refer to that example anymore, because is easier explain it in
a more abstract level:

REPEAT
   'do something
UNTIL cond1 OR (cond2 AND cond3) ...

WHILE cond1 AND cond2 OR cond3
  'do something
WEND

Where one of the above conditions (condX) is that usually is write
inside the loop to allow the BREAK or CONTINUE sentence (or RETURN).

Just in case:

REPEAT
     b = TabStrip3.Count ' In fact, this does nothing usefull
     INC a
UNTIL a < TabStrip3.Count OR TabStrip3[a].Caption = IdCaption


-- 
Fabián Flores Vadell
www.speedbooksargentina.blogspot.com




More information about the User mailing list