PUBLIC SUB MaxFind(tomb AS String[], minta AS String) AS Integer ' A function in Archs module that finds the highest index in the array tomb which contains minta DIM supst AS String[] DIM mfind AS Integer = -1 DIM cel AS Integer supst = NEW String[] supst = tomb WHILE supst.Find(minta) <> -1 cel = supst.Find(minta) mfind = cel IF cel >= 0 THEN supst[cel] = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ENDIF WEND supst.Clear RETURN mfind END
---------------------- 'This is the problematic part: when the Arch.MaxFind() returns -1 the block is executed and the program crashes, since an array could not have index -1. But it means for Gambas even if -1>-1 is FALSE the block is executed! IF Archs.MaxFind(temporal, telem) > -1 THEN j = Archs.MaxFind(temporal, telem) IF temporalpath[j] <> tut THEN temporal.Add(telem) temporalpath.Add(tut) ENDIF ENDIF ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user