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

Gianluigi bagonergi at ...626...
Sat Jul 1 17:15:10 CEST 2017


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 <hans at ...3219...>:

>
> 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."
>      Else
>         Print "Array is not empty!"
>      Endif
>   Else
>      Print "Array not exist."
>   Endif
>
> Hans
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> 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