Re: lists and items and position of items
Re: lists and items and position of items
- Subject: Re: lists and items and position of items
- From: Neil Faiman <email@hidden>
- Date: Sat, 12 Mar 2005 07:58:13 -0500
On Mar 11, 2005, at 12:48 PM, Michelle Steiner wrote:
On Fri, March 11, 2005 8:50 am, Christian Vinaa said:
...
on list_position(this_item, this_list)
repeat with i from 1 to the count of this_list
if item i of this_list is this_item then return i
end repeat
return 0
end list_position
because in every instance the handler is returning zero. You need to
put
"return 0" in an "else" clause of the "if-then" statement
Sorry, but not so. Christian's code is just right. Each time through
the loop, it compares an item of the list to the item he is looking
for, and returns the value of i, which is the index of that item in the
list, if they match -- then the loop doesn't terminate normally and the
"return 0" is never reached. If no item matches, then the loop
terminates normally, falls out the bottom of the loop, and executes the
"return 0".
The problem is as yvan describes -- the fact that Christian is passing
a reference rather than a string as the argument to the list_position
function.
Regards,
Neil Faiman
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden