in reply to Re: Isolating DNA cont.
in thread Isolating DNA cont.
G'day Alex,
++ I just wanted to add my agreement with, and recommendation of, this method of coding.
I started doing this many years ago — in fact, possibly a couple of decades ago — and it's made my (programming) life a whole lot easier.
Nowadays, without really having to think about it, I start sections of code like:
while (<$fh>) { }
or
if ($condition) { } else { }
I then don't have to remember to add closing braces. I also don't need to worry about aligning the closing braces to get the proper indentation: auto-indent has already done that for me.
The same works for other balanced characters. Building up a complex expression incrementally like this:
if () { if (is_whatever()) { if (is_whatever(get_whatever())) { if (is_whatever(get_whatever(get_options()))) {
almost never results in a "mis-matched parentheses" type error.
Attempting to type that final expression all at once, often will; and leaves you having to scan back and forth over the expression, counting opening and closing parentheses.
I also use this method for building up complex regular expressions (using the x or xx modifiers).
This may not work for everyone; for example, perhaps syntax-highlighting is set up to indicate mis-match problems. However, it certainly works for me and clearly works for you. I would recommend people at least try it.
— Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Isolating DNA cont.
by hippo (Archbishop) on Dec 22, 2018 at 11:47 UTC | |
by talexb (Chancellor) on Dec 22, 2018 at 21:15 UTC | |
by kcott (Archbishop) on Dec 22, 2018 at 12:25 UTC |