Checking through an array...

Hello. Lets say I have an array of objects. If I define a series of integers in another array, how can check through the game object array (starting from element 0 of the integer array) until one the elements meets a certain condition(ex: destroy the first element that is not null)? For example; Integer Array = [2,27,62,105, 109]. Elements 2, 27, and 105 of the object array do not meet the condition, but 62 and 109 do. How can I have the script check through the array and determine that element 62 meets the condition? Thanks

This should work for you:

var nameOfArray : int[] = [2,27,62,105,109];

function Start()
{
	print(CheckArray());
}

function CheckArray() : int
{
	//loop through each value in array
	for(var num in nameOfArray)
	{
		//conditional statement
		if(num == 99)
		{
			return num;
		}
	}
	//if no condition is met, return 0
	return 0;
}

Hope it helps.