• 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: Considerable simplification should be possible
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Considerable simplification should be possible


  • Subject: Re: Considerable simplification should be possible
  • From: Stan Cleveland <email@hidden>
  • Date: Mon, 28 Apr 2014 17:29:05 -0700

On Apr 28, 2014, at 4:04 PM, Shane Stanley wrote:

set volumeChoice to (choose from list namesArray with prompt "Choose a volume to mount.")
…
set volumeChoice to item 1 of volumeChoice

Hi all,

I've always been one for clarity, first, and efficiency, second, in my AS coding. To that end, I'd like to suggest a further simplification of the code that Shane posted a bit ago.

The two lines quoted above can be replaced by this one line:

set {volumeChoice} to (choose from list namesArray with prompt "Choose a volume to mount.")

For each pair of braces added around a variable name when it's defined, one pair is removed from its definition. There's no need to "unbrace" volumeChoice with a separate line of code. 

Here's another silly, but clear, example of this technique:

set nestedList to {{{{"Hello, world"}}}}
set {{{{greeting}}}} to nestedList
return greeting
--> "Hello, world"

Regards,
Stan C.

 _______________________________________________
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: Considerable simplification should be possible
      • From: Shane Stanley <email@hidden>
    • Re: Considerable simplification should be possible
      • From: waynemelrose <email@hidden>
References: 
 >Re: Considerable simplification should be possible (From: Lists <email@hidden>)
 >Re: Considerable simplification should be possible (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Considerable simplification should be possible
  • Next by Date: Re: Considerable simplification should be possible
  • Previous by thread: Re: Considerable simplification should be possible
  • Next by thread: Re: Considerable simplification should be possible
  • Index(es):
    • Date
    • Thread