Go to: Synopsis. Return value. MEL examples.
 
int intArrayInsertAtIndex(int $index, int[] $list, int $item) 
	 
None
| Variable Name | Variable Type | Description | 
|---|---|---|
| $index | int | The index into $list to add $item at | 
| $list | int[] | A list of int values. | 
| $item | int | The new item to add to $list at $index | 
  // Initialize the list
  int $list[] = {1, 3};
  // Result: 1 3 //
  // Insert in the middle of the sequence
  intArrayInsertAtIndex(1, $list, 2 );
  // Result: 1 //
  print $list;
  // Result: 1 2 3 //
  // Insert before the first element
  intArrayInsertAtIndex(-1, $list, 4 );
  // Result: 0 //
  // Insert at ( or after ) the last element
  intArrayInsertAtIndex(10, $list, 4 );
  // Result: 1 //
  print $list;
  // Result: 1 2 3 4 //
  // Insert at the beginning of the sequence
  intArrayInsertAtIndex( 0, $list, 0 );
  // Result: 1 //
  print $list;
  // Result: 0 1 2 3 4 //