• 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: Deleting last item of a List
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Deleting last item of a List


  • Subject: Re: Deleting last item of a List
  • From: Nigel Garvey <email@hidden>
  • Date: Fri, 19 Nov 2004 21:00:08 +0000

doug rogers wrote on Thu, 18 Nov 2004 23:32:57 -0500:

>Can't seem to delete the last item of a list.

Strictly speaking, you can't delete an item from a list. You can only
make another list that doesn't include that item. There have been
examples of how to do this posted already.

>Bruce Perry's book mentions last item of a list.
>
>Does End replace Last?

They're not quite the same. 'End' is a property of the list itself.
'Last' is one way of specifying the last *item* that's currently in it.
'Last item' can also be expressed as 'item -1'. (Or '-1th item' or 'back
item', if you're into those sorts of thing.) 'Last' can also specify the
last item of particular class in the list, such as 'last integer of
myList'. The last integer might not necessarily be the last item in the
list. Sometimes, 'last item' behaves similarly to 'end':

  set x to end of myList -- get the last item in the list
  set x to last item of myList -- ditto

(For some reason, the former executes more quickly.)

But:

  set end of myList to x -- append another item to end of the list
  set last item of myList to x -- change the value of the existing last
item

NG
 _______________________________________________
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: Deleting last item of a List
      • From: Paul Berkowitz <email@hidden>
    • Re: Deleting last item of a List
      • From: Hanaan Rosenthal <email@hidden>
  • Prev by Date: Re: Simple text formatting in Quark6
  • Next by Date: Re: Deleting last item of a List
  • Previous by thread: Re: Deleting last item of a List
  • Next by thread: Re: Deleting last item of a List
  • Index(es):
    • Date
    • Thread