what does your code look like? format this if statement! (taken from the
Wikipedia page on programming style)
if (hours < 24 && minutes < 60 && seconds < 60) {
return true;
}
else {
return false;
}
I think I made up my own indent style. that "else" should probably go on the same line as the first closing brace.
I prefer "} else {" but I'd write that code as
return (hours < 24 && minutes < 60 && seconds < 60)
:P
return (hours < 24 && minutes < 60 && seconds < 60);
:)
if (hours < 24 && minutes < 60 && seconds < 60) {
return true;
} else {
return false;
};
if the variable names were longer, i'd do this:
if (hours < 24 &&
minutes < 60 &&
seconds < 60) {
return true;
} else {
return false;
};
if (hours < 24 && minutes < 60 && seconds < 60)
{
return true;
}
else
{
return false;
}
Anything in a bracket is tabbed.
i try to do the same as arun--i'd guess that single-quotes are marginally faster.
> i try to do the same as arun--i'd guess that single-quotes are marginally faster.
If you're using a language where there's a difference in meaning, it's not really a question of coding style. I use Python a lot, where " means exactly the same as '.