Quote: "With a ref you can set the value to the array element and then work with the ref and not worry about the index."
yes that's something I like to do, its tidier and more practical.
a small example for anyone wondering the difference
Type myType
stringValue as string
integerValue
EndType
Global myVar as myType[]
Function AddItem(varType ref as myType[], stringValue as string, integerValue)
newsize=varType.length+1
varType.length=newsize
varType[newsize].stringValue=stringValue
varType[newsize].integerValue=integerValue
EndFunction
// change item by type ref
Function ChangeItem_A(varType ref as myType, stringValue as string, integerValue)
varType.stringValue=stringValue
varType.integerValue=integerValue
EndFunction
// change item by array ref
Function ChangeItem_B(varArray ref as myType[], index, stringValue as string, integerValue)
varArray[index].stringValue=stringValue
varArray[index].integerValue=integerValue
EndFunction
for i=0 to 20
AddItem(myVar, "some string value", i+20)
next
ChangeItem_A(myVar[10], "new string value", 999)
ChangeItem_B(myVar, 9, "new string value", 999)
do
Print(myVar[9].stringValue)
Print(myVar[9].integerValue)
Print(myVar[10].stringValue)
Print(myVar[10].integerValue)
Sync()
loop