2010/4/13 Jussi Lahtinen <jussi.lahti...@gmail.com>:
> 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

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to