• 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: Thirteen Scripters Scripting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thirteen Scripters Scripting


  • Subject: Re: Thirteen Scripters Scripting
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 25 Dec 2008 09:52:45 -0500

On Thu, Dec 25, 2008 at 9:40 AM, David Marshall <email@hidden> wrote:
> Speaking of C, I do wish AppleScript included a "switch"
> statement and a "case" label:
>
> switch (i) {
> case 12: printf ("twelve drummers drumming,\n");
> case 11: printf ("eleven pipers piping,\n");
> case 10: printf ("ten lords a-leaping,\n");
> case 9: printf ("nine ladies dancing,\n");
> case 8: printf ("eight maids a-milking,\n");
> case 7: printf ("seven swans a-swimming,\n");
> case 6: printf ("six geese a-laying,\n");
> case 5: printf ("five golden rings,\n");
> case 4: printf ("four calling birds,\n");
> case 3: printf ("three French hens,\n");
> case 2: printf ("two turtle doves, and \n");
> case 1: printf ("a partridge in a pear tree.\n"); break;
> }
>
> I like the elegant simplicitly of building a list of n items by "falling
> through" to the nth-1 item.

Somehow I don't think the elegance of solutions like this makes up for
all the hard-to-find bugs caused by missing "break" statements over
the years. :)

--
Mark J. Reed <email@hidden>
 _______________________________________________
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

References: 
 >Re: Thirteen Scripters Scripting (From: David Marshall <email@hidden>)

  • Prev by Date: Re: Thirteen Scripters Scripting
  • Next by Date: Re: Thirteen Scripters Scripting
  • Previous by thread: Re: Thirteen Scripters Scripting
  • Next by thread: Re: Thirteen Scripters Scripting
  • Index(es):
    • Date
    • Thread