• 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: set vs copy?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set vs copy?


  • Subject: Re: set vs copy?
  • From: "Mark J. Reed" <email@hidden>
  • Date: Tue, 14 Sep 2010 19:51:45 -0400

set A to {1,2,3}
set B to A
copy A to C

set end of A to 4
set end of B to 5

set text item delimiters to ","
log("A is " & A as text)
log("B is " & B as text)
log("C is " & C as text)

Result:

A is 1,2,3,4,5
B is 1,2,3,4,5
C is 1,2,3


A and B are both pointing to a single list; changing that list,
whether you go through A or B, results in a change visible through
both.  C is a separate copy of that list made when it only had 3
elements, unaffected by subsequent modifications to the original.  You
can, of course, now go and modify C, and it won't affect A or B.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: set vs copy?
      • From: Thomas Fischer <email@hidden>
References: 
 >Re: set vs copy? (From: Shane Stanley <email@hidden>)
 >Re: set vs copy? (From: Bruce Robertson <email@hidden>)

  • Prev by Date: Re: set vs copy?
  • Next by Date: Re: set vs copy?
  • Previous by thread: Re: set vs copy?
  • Next by thread: Re: set vs copy?
  • Index(es):
    • Date
    • Thread