• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: lists and items and position of items
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: lists and items and position of items
      • From: Christian Vinaa <email@hidden>
References: 
 >lists and items and position of items (From: Christian Vinaa <email@hidden>)
 >Re: lists and items and position of items (From: "Michelle Steiner" <email@hidden>)

  • Prev by Date: Re: Xmail
  • Next by Date: Re: Xmail
  • Previous by thread: Re: lists and items and position of items
  • Next by thread: Re: lists and items and position of items
  • Index(es):
    • Date
    • Thread