[Gambas-user] Super quickie - array equality

Fabien Bodard gambas.fr at ...626...
Thu Oct 22 08:34:00 CEST 2015


Le 22 oct. 2015 05:43, "adamnt42 at ...626..." <adamnt42 at ...626...> a écrit :
>
> On Wed, 21 Oct 2015 22:54:48 +0300
> Jussi Lahtinen <jussi.lahtinen at ...626...> wrote:
>
> > Your original question hinted at 2D arrays, but [0, 0] is one
dimensional
> > array with two values.
> > So, in other words you would like quick way to check first two values of
> > the array?
>
> and that its length is 2.
>
> >
> > I think this is the simplest:
> >
> > If myArray[0] = 0 And If myArray[1] = 0 Then
>
> so
> If myArray.Count=2 And If myArray[0] = 0 And If myArray[1] = 0 Then
>
> >
> > However, why you need an array for only two values?
> It's just for simplicity of passing the two numbers around as
parameters...
> The actual use is a layout for tiling, i.e. x tiles wide by y tiles tall.
> I could have of course used LayoutX and LayoutY but as the pair is used
in may parts of this app and passed as a parameter to many functions it is
easier to use an array.
> (The app is a design tool for a "client" (my sister) who is a mosaic
artist and the layout is for the repeating tiles of a design pattern. It
was supposed to be a quicky to solve a "simple" problem she had. As ever -
simple, hah!)
> >

As ever 😊

Maybe an array.compare(array) as Boolean function will be welcome ...

And an array.diff(array) as array too..

That can return diff elements in read order.

> >
> > Jussi
> >
> >
>
> regards
> bruce
>
> --
> B Bruen <adamnt42 at ...3379... (sort of)>
>
>
------------------------------------------------------------------------------
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user



More information about the User mailing list