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.
|