Difference between revisions of "Ar Find"

265 bytes added ,  19:44, 28 June 2014
Clarirified examples
imported>Odessa
(created)
 
imported>Odessa
(Clarirified examples)
 
(One intermediate revision by the same user not shown)
Line 13: Line 13:
   |Type = range}}}}
   |Type = range}}}}
==Example==
==Example==
A numeric indexed array ("array" or "map"):
<pre>
if eval (Ar_Find SomeValue, SomeArray) != Ar_BadNumericIndex
    ; then SomeValue is an element in SomeArray
endif
</pre>
A string indexed array ("stringmap"):
<pre>
if eval (Ar_Find SomeValue, MyStringMap) != Ar_BadStringIndex
    ; then SomeValue is an element in MyStringMap
endif
</pre>
Another numeric example, with extra context:
<pre>
<pre>
array_var aBeatles
array_var aBeatles
Line 20: Line 35:
if eval (Ar_Find RingoREF, aBeatles) != Ar_BadNumericIndex
if eval (Ar_Find RingoREF, aBeatles) != Ar_BadNumericIndex
     ; * Ringo is found somewhere in the array aBeatles
     ; * Ringo is found somewhere in the array aBeatles
elseif eval (Ar_Find JohnREF, aBeatles) < (Ar_Find PaulREF, aBeatles)
    ; * John is found earlier in the array than Paul


elseif eval (Ar_Find GeorgeREF, aBeatles, 1:2) != Ar_BadNumericIndex
elseif eval (Ar_Find GeorgeREF, aBeatles, 1:2) != Ar_BadNumericIndex
Line 30: Line 42:


</pre>
</pre>
==See Also==
==See Also==
*[[Array Variables]]
*[[Array Variables]]
Anonymous user