An array is an ordered box of values in a single variable — the everyday workhorse for lists of anything.
1 Ordered lists
An array keeps its values in order: ["apple", "banana", "cherry"].
2 Zero-based index
fruits[0] is the first item — counting starts at zero, not one.
3 Grow with push
fruits.push("date") appends to the end; length reports how many you have.
4 each walks it all
One block pass per element, in order — the friendliest way to visit everything.
One variable, many values
Ordered lists1An array keeps its values in order: ["apple", "banana", "cherry"]. Zero-based index2fruits[0] is the first item — counting starts at zero, not one.
Grow with push3fruits.push("date") appends to the end; length reports how many you have.
each walks it all4One block pass per element, in order — the friendliest way to visit everything. 4 building blocks make up One variable, many values
Watch an array grow, then let each visit every element one by one.
mainfruits starts with three strings, kept in order.
Memory
fruits= ["apple", "banana", "cherry"]
Console
output appears as the program runs…
Cells sit side by side, each with a number. Play the script, then drag to orbit.
Drag to orbit the scene. Press Play to watch memory in action.
Click an expression, then click what it does to lock the pair.
6 conceptsTap a card to expand ?fruits[0]drops into place
?push("x")drops into place
?lengthdrops into place
?eachdrops into place
?fruits[-1]drops into place
?first / lastdrops into place
Add up an array — including the element you just pushed.
Your predicted output — one line per console line
Hint: each adds every element into total, in order — including the 16 you pushed. 4 + 8 + 15 + 16 = 43.
01Arrays keep order; index 0 is the first element.
02push appends, length counts, last grabs the final element.
03each runs a block once per element — no index bookkeeping needed.
04A negative index counts from the end: fruits[-1] is the last item.
05One cell holds exactly one value — assigning overwrites it.