[Courses] Re: pesky brackets
Dreaming Kat
dreamingkat at ivillage.com
Thu Jan 24 17:16:03 EST 2002
Adding to the list of ways to avoid missing an end bracket (hope ppl don't mind me sniping like this w/o credit)
1. indent code consistently.
2. keep functions fairly short, so you can see where they start and end.
3. Use an editor that does syntax-sensitive auto-indent.
4. especially when 2 & 3 aren't possible, comment each closing bracket.
I do this all the time for anything more than about 6 lines long and for the end of all functions. Especially when coupled with proper indenting and using a lots of white-space approach, it helps alot. if nothing else, you get in the habit of looking back up to where the bracket opened to figure out a good comment. :)
a further note on emacs, it will highlight the corresponding open bracket when you type a closing bracket. if the opening bracket is not on the screen, it will display the line in the status bar if your in X.
"Unexpected end of file" has so far proven to be a missing closing bracket every single time I've seen it, but missing brackets will cause other problems too (similar problems to forgetting those semi-colons). :)
-- marykat
_________________________________________________________________
iVillage.com: Solutions for Your Life
Check out the most exciting women's community on the Web
http://www.ivillage.com
More information about the Courses
mailing list