// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // // // // int intArrayContains(int $item, int[] $list) // // // Return true if array contains the item. // // The array may contain more than one occurrence of the item. // This procedure will return true as soon as it finds one // occurrence. // // // int $item The int item to search for in the int array. // int[] $list A list of int values. // // // int : True if the int array contains the item. // // // int $list[] = { 1, 2, 3 }; // // ,Result:, 1 2 3 // // int $found = intArrayContains( 1, $list ); // // Result: 1 // // $found = intArrayContains( 2, $list ); // // Result: 1 // // $found = intArrayContains( 0, $list ); // // Result: 0 // // // // global proc int intArrayContains(int $item, int $list[]) { int $listItem; for ($listItem in $list) { if ($item == $listItem) return true; } return false; }