Go to: Synopsis. Return value. MEL examples.

Synopsis

int intArrayFind(int $item, int $index, int[] $list)

Return the index of the item if it is in the array and -1 otherwise. The array may contain more than one occurrence of the item. This procedure will return the index of the first occurence of item starting at index.

Return value

int : The index of the item if it is in the array and -1 otherwise.

Arguments

Variable Name Variable Type Description
$itemintThe int item to search for in the int array.
$indexintThe array index to begin the search at
$listint[]A list of int values.

MEL examples

	int $array1[] = { 1, 2, 3 };
	// ,Result:, 1 2 3 // 
	int $index = intArrayFind( 1, 0, $array1 );
	// ,Result:, 0 // 
	int $index = intArrayFind( 2, 0, $array1 );
	// ,Result:, 1 // 
	int $index = intArrayFind( 3, 4, $array1 );
	// ,Result:, -1 // 
	int $index = intArrayFind( 0, 0, $array1 );
	// ,Result:, -1 //