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

Re: how?


  • Subject: Re: how?
  • From: has <email@hidden>
  • Date: Thu, 14 Jan 2010 21:23:49 +0000

LuKreme wrote:

> On 13-Jan-2010, at 17:59, Chris Page wrote:
>> I find that code misleading because it implies that that test will actually be used to exit the loop, but it isn‚t. I recommend changing it to just „repeat ∑ end repeat‰, which makes it clearer to the reader that the loop is exited due to some code inside the loop.
>
>
> I agree that in the context of a book about learning to code the construction given was a poor choice.
>
> However, in terms of actual coding, that's a pretty common and also rather useful way to construct a loop. It makes it quite readable to another programmer and makes it much easier to follow the logical thread.
>
> As for exiting in the middle of  a loop being 'clunky' as someone else said, that's just total BS.

If you're referencing my post, I said it was 'schlonky'; as in sloppy; careless; poorly planned and/or written.

It is bad code because it misleads readers about how it works, not because it doesn't adhere to any One True Way of Exiting a Loop. Ironically, the code itself is trying to do it both ways, and flubbing one of them.

Since you say this is in a book, I'd suggest dropping a polite note to the author/publisher, drawing their attention to the issue and suggesting they replace the lines:

	set ValidInput to false
	repeat until ValidInput = true

with:

	repeat

in their errata and future editions.

has
--
Any fool can write code that a computer can understand.
Good programmers write code that humans can understand.
~Martin Fowler
 _______________________________________________
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: how?
      • From: Simon Topliss <email@hidden>
  • Prev by Date: Re: exit repeat abuse;-)
  • Next by Date: RE: exit repeat abuse;-)
  • Previous by thread: Re: how?
  • Next by thread: Re: how?
  • Index(es):
    • Date
    • Thread