Re: [Gambas-user] how to determine if array its empty

2017-07-01 Thread Cristiano Guadagnino
Thank you Jussi, that's a nice trick I didn't know of! Actually, I didn't even notice there was an extra "if" in Gianluigi's example. Cris On Sat, Jul 1, 2017 at 3:28 PM, Jussi Lahtinen wrote: > If you add the extra "if", then Gambas will do short-circuit evaluation.

Re: [Gambas-user] how to determine if array its empty

2017-07-01 Thread Gianluigi
Ok, very precise, depends on what you need. I think at work, if you have to read the array, an: If IsNull (myArray) Or If myArray.Count = 0 Then Return It is more practice Gianluigi 2017-07-01 16:15 GMT+02:00 Hans Lehmann : > > Case 1: > Dim myArray As String[] -->

Re: [Gambas-user] how to determine if array its empty

2017-07-01 Thread Hans Lehmann
Case 1: Dim myArray As String[] --> Array not exist. Case 2: Dim myArray As New String[] --> Array ist empty. Case 3: Dim myArray As New String[] --> Array is not empty! myArray.Add("Value") If Not IsNull(myArray) Then If myArray.Count = 0 Then Print "Array ist empty."

Re: [Gambas-user] how to determine if array its empty

2017-07-01 Thread Gianluigi
Hi Hans, If the array is not instantiated or does not work (first example) or does error. Regards Gianluigi 2017-07-01 15:36 GMT+02:00 Hans Lehmann : > Correct? > > If (Not IsNull(myArray) And myArray.Count = 0) Then Print "Array is empty" > > Hans > >

Re: [Gambas-user] how to determine if array its empty

2017-07-01 Thread Hans Lehmann
Correct? If (Not IsNull(myArray) And myArray.Count = 0) Then Print "Array is empty" Hans -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

Re: [Gambas-user] how to determine if array its empty

2017-07-01 Thread Jussi Lahtinen
If you add the extra "if", then Gambas will do short-circuit evaluation. https://en.wikipedia.org/wiki/Short-circuit_evaluation Jussi On Sat, Jul 1, 2017 at 3:08 PM, Cristiano Guadagnino wrote: > Hi Gianluigi! > > On Sat, Jul 1, 2017 at 12:13 PM, Gianluigi

Re: [Gambas-user] how to determine if array its empty

2017-07-01 Thread Hans Lehmann
Hallo, my idea: Dim myArray As New String[] ' Existiert das Array und ist die Anzahl der Elemente gleich Null, dann ist das Array leer If Not IsNull(myArray) And If myArray.Count = 0 Then Print "Array is empty" Hans

Re: [Gambas-user] how to determine if array its empty

2017-07-01 Thread PICCORO McKAY Lenz
2017-07-01 8:08 GMT-04:00 Cristiano Guadagnino : > Hi Gianluigi! > > On Sat, Jul 1, 2017 at 12:13 PM, Gianluigi wrote: > > > or > > If IsNull(myArray) Or If myArray.Count = 0 Then Print "Empty" > > > > I have not tried, but I don't think this will work.

Re: [Gambas-user] how to determine if array its empty

2017-07-01 Thread Gianluigi
Hi Cristiano, Or If is only evaluated if *not* IsNull. Regards Gianluigi 2017-07-01 14:08 GMT+02:00 Cristiano Guadagnino : > Hi Gianluigi! > > On Sat, Jul 1, 2017 at 12:13 PM, Gianluigi wrote: > > > or > > If IsNull(myArray) Or If myArray.Count = 0

Re: [Gambas-user] how to determine if array its empty

2017-07-01 Thread Cristiano Guadagnino
Hi Gianluigi! On Sat, Jul 1, 2017 at 12:13 PM, Gianluigi wrote: > or > If IsNull(myArray) Or If myArray.Count = 0 Then Print "Empty" > I have not tried, but I don't think this will work. In an "or" expression you have to evaluate both members, so if myArray is null the

Re: [Gambas-user] how to determine if array its empty

2017-07-01 Thread Gianluigi
or If IsNull(myArray) Or If myArray.Count = 0 Then Print "Empty" Regards Gianluigi 2017-07-01 12:09 GMT+02:00 Gianluigi : > Dim myArray As String[] > > If IsNull(myArray) Then Print "Empty" > > Regards > Gianluigi > > 2017-07-01 11:33 GMT+02:00 PICCORO McKAY Lenz

Re: [Gambas-user] how to determine if array its empty

2017-07-01 Thread Gianluigi
Dim myArray As String[] If IsNull(myArray) Then Print "Empty" Regards Gianluigi 2017-07-01 11:33 GMT+02:00 PICCORO McKAY Lenz : > i have > > Dim ar As New Variant[] > > so how can i determine if the array its empty, i mean does not added any > element.. due that

[Gambas-user] how to determine if array its empty

2017-07-01 Thread PICCORO McKAY Lenz
i have Dim ar As New Variant[] so how can i determine if the array its empty, i mean does not added any element.. due that piece of code fails: If value.dim > 0 Then If value.count > 0 Then with a index out of bound exception Lenz McKAY Gerardo (PICCORO) http://qgqlochekone.blogspot.com