On May 31, 7:13 am, desktop <f...@sss.comwrote:
Which would you prefer:
[brackets or no brackets for single line of if]
As Michael said, option C.
It may simply be the kind of engineering projects I've
been involved in over the last few years. But one of the
principles that gets drilled on pretty harshly is, for
every task you must define the start and end of the task
before you actually start the task.
So I alwasy type things in the following way. When I'm
going to put in an "if" statement, first I type this.
if()
{
}
That is, I define the scaffold that provides the bounds.
Then I fill in the condition inside the if() part.
Then I put the lines of code between the { and },
and I do this even if I expect there to be only one
line of code.
I do much the same thing for functions. Say I'm going
to have a function called myFunc. First I type this.
myFunc()
{
}
Then I fill in the return type, then the argument list,
then I start on the code. Same for while, for, etc.
Socks