Retrieving an Element of an Array: Difference between revisions

No edit summary
Line 340:
element = array[[index]]
</lang>
First index is 1, negative indices count from the back, -1 being the last element. [ [ 0 ] ] returns the head. The [ [ ] ]-command (Part) works not only on a list, it works on everything: graphics, equations, matrices of any dimension et cetera. To dig deeper you can specifiy multiple indices [ [ a, b, c ] ] to get the c<sup>th</sup> element of the b<sup>th</sup> element of the a<sup>th</sup> element. For any level you can specify a range using ;;, i.e.: a;;b;;c would give elements a through b in steps of c. If a is not given it will assume 1, if b is not give it will be -1, if c is not given it will be 1.
 
=={{header|MAXScript}}==
1,111

edits