Page 1 of 1

ArrayItems()

Posted: Wed Mar 23, 2005 12:30 am
by Killswitch
Returns the number of items in an array that aren't null

i.e.

Dim a(10)

a(5)=1

b=ArrayItems()

;b=1

Posted: Fri Mar 25, 2005 7:02 pm
by leo1991
I don't think, this is useful. It isn't used often, so it isn't needed to be
added to PB :D You could try it with this Procedure:

Code: Select all

;
;  25.3.2005
;  Array Items
;  By leo1991 in English Forum
;

Procedure ArrayItems(*Array.LONG)
    *Array - 8
    Size = *Array\l - 1
    *Array + 8
    RetVal.l
    For I = 0 To Size 
        If *Array\l 
            RetVal + 1
        EndIf
        *Array + 4
    Next
    ProcedureReturn RetVal
EndProcedure

Dim a(10)
a(5) = 1
a(7) = 100
Debug ArrayItems(@a())
cya,
leo

P.S.:Sorry for my bad english, i'm german ;)