roku arrays

I’m new at roku development, and have some programming experience.
I’m trying to capture 3 previous sku# into an array. I’ve been trying to get it to work using

prevItemList = CreateObject(“roArray”,3,true)

but not having much luck getting the list to print.

Can anyone point me to an example, or give me some ideas on this.

thanks.
scott

You need to use Push to populate your array
If you do it this way
myAyrray.Push( myData1 )
myArray.Push (myData2 )

For each data in myArray
Print data
End for

No need to bother with createObject, you can directly construct array with [ ]; also add/remove elements at the end with .push/.pop.

BrightScript Debugger> SKUs = [123456, "AK-47", "RPG-7"]
BrightScript Debugger> ? SKUs
 123456
AK-47
RPG-7