Array: Difference between revisions

Content added Content deleted
Line 232: Line 232:


"an new created array with 5 elements computed from expressions (at run time)"
"an new created array with 5 elements computed from expressions (at run time)"
a3 := { 10 . 20 . (a1 at:3) . 40 squared }.</lang>
a3 := { 10 . 20 . (a1 at:3) . 40 squared }.


"access by index (notice: in Smalltalk index starts at 1)"
accessing:
<lang smalltalk>"access by index (notice: in Smalltalk index starts at 1)"
a1 at:2. -> 20
a1 at:2. -> 20
a1 at:index put:100. -> error; immutable
a1 at:index put:100. -> error; immutable