Index of Handler
Index of Handler
- Subject: Index of Handler
- From: List Guy <email@hidden>
- Date: Wed, 11 Jul 2001 10:25:59 -0700
I'd appreciate someone telling me if my supposition about
on IndexOf(lst, itm)
set x to 1
tell no & lst to if {itm} is in it then repeat until item x = itm
set x to x + 1
end repeat
x - 1
end IndexOf
is correct:
"no", the applescript constant for use with the close command, is used here
to substitute for a longer block of code for when itm isn't in lst. I tried
"yes", "all caps" and other constants and all worked. That is, "no" is used
because the indexOf handler assumes that itm will never be the applescript
constant "no".
I suppose that
on IndexOf(lst, itm)
set x to 1
tell missing value & lst
if {itm} is in it then
repeat until item x = itm
set x to x + 1
end repeat
end if
end tell
return x - 1
end IndexOf
might be clearer because it uses the "missing value" constant, except that
soemone might query the list to see if it contains a missing value.
grh