On Thursday, Mar 6, 2003, at 15:50 America/Chicago, Kerry Thompson wrote:

I took over a project not long ago, and one of the first things I
noticed was this movie handler:

on prepareMovie
on keyDown
--yada yada
end keyDown
end prepareMovie

I came across an interesting set of repeat loops a while back:


  repeat while someCondition then
  --
  end repeat

and

  repeat with someCounter then
  --
  end repeat

I'd never seen a 'then' at the end of a repeat. The compiler didn't whine and the code worked fine.

One of the all time commonest is the compacted if thens:

if this then that

and

  if this then
    that
  else the other thing

I used to do it that way too but, like Bruce Epstein, came across conditions where those one-liners and compacted structures didn't work properly. Since then I've been a hardcore fan of the classic three-liner:

  if this then
    that
  end if

and

  if this then
    that
  else
    the other thing
  end if

Takes up a little more space but it is generally easier to read, and it never, ever fails at runtime.

I've got a chapter or two on well-formed Lingo; I'm a fan of whitespace and pretty rigorous coding structures. It's a little more work but it makes everything a hell of a lot easier to read. It's also easier for others to maintain, and for you to remember what you were thinking if you haven't looked at your code in a year and a half.


Warren Ockrassa | http://www.nightwares.com/ Director help | Free files | Sample chapters | Freelance | Consulting Author | Director 8.5 Shockwave Studio: A Beginner's Guide Published by Osborne/McGraw-Hill http://shop.osborne.com/cgi-bin/osborne/0072195622.html

[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]

Reply via email to