Difference between revisions of "Array nth Functions"

From ZCubes Wiki
Jump to navigation Jump to search
Line 57: Line 57:
  
 
Array.millionth
 
Array.millionth
 
Array.firstelement
 
 
Gives first element.
 
 
Array.lastelement
 
 
Gives last element.
 
  
 
1..5.second()
 
1..5.second()
Line 78: Line 70:
 
| 7 || 25 || 13 || 1 || 19  
 
| 7 || 25 || 13 || 1 || 19  
 
|}
 
|}
 +
 +
==Array element ==
 +
 +
===Array.firstelement===
 +
 +
Gives first element.
 +
 +
===Array.lastelement===
 +
 +
Gives last element.
 +
 +
==NTHELEMENT(nTh, Array)==
 +
 +
Return the nth element from Array.
 +
 +
The following will give the 1st to 10th element in an array.
 +
 +
ELEMENT1
 +
ELEMENT2
 +
ELEMENT3
 +
ELEMENT4
 +
ELEMENT5
 +
ELEMENT6
 +
ELEMENT7
 +
ELEMENT8
 +
ELEMENT9
 +
ELEMENT10
 +
 +
 +
ELEMENT9(1..10)
 +
 +
9
 +
 +
1..10.firstelement()
 +
 +
1
 +
 +
1..10.lastelement()
 +
 +
10

Revision as of 14:27, 4 March 2017


Array.nth(SomeNth, SomeCount)

Get the nth element from the array. SomeCount (default as 1) of elements from the nth index is given. Result is an array.

If the first element is required, use the Array.firstelement() or Array.lastelement().

The following are the easier way to get the xth element from an array. If multidimensional array, it gives the xth row.

Array.first

Array.second

Array.third

Array.fourth

Array.fifth

Array.sixth

Array.seventh

Array.eighth

Array.nineth

Array.tenth

Array.eleventh

Array.twelfth

Array.thirteenth

Array.fourteenth

Array.fifteenth

Array.sixteenth

Array.seventeenth

Array.eighteenth

Array.nineteenth

Array.twentieth

Array.hundredth

Array.thousandth

Array.millionth

1..5.second()

2


MAGICSQUARE(5).third()

7 25 13 1 19

Array element

Array.firstelement

Gives first element.

Array.lastelement

Gives last element.

NTHELEMENT(nTh, Array)

Return the nth element from Array.

The following will give the 1st to 10th element in an array.

ELEMENT1 ELEMENT2 ELEMENT3 ELEMENT4 ELEMENT5 ELEMENT6 ELEMENT7 ELEMENT8 ELEMENT9 ELEMENT10


ELEMENT9(1..10)

9

1..10.firstelement()

1

1..10.lastelement()

10