|
It's just how I was raised.
|
|
|
|
|
You're right. Updated.
cheers
Chris Maunder
|
|
|
|
|
So that intent is clear. I saw code once that did not have curly braces but the lines below were also indented. So annoying because it looked like all the lines were part of the statement.
Don't be so lazy. Just always use them.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
my bacon crispy. Usually 3 slices per burger does the trick. Mayo on one roll, spicy brown mustard on the other (or dijon). Lettuce (Iceburg, shredded), swiss cheese or American if melted. White onion chopped. No tomatoes for me, thanks.
Salt and pepper to taste, on the medium rare burger (70% fat on the burger meat) Lean vs Fat: What's The Perfect Ratio For Burgers? – Schweid & Sons – The Very Best Burger[^]
Buns lightly toasted with butter (real not fake).
-- rants are the vehicle of the lazy and uninspired - JSOP 2/2018
|
|
|
|
|
Well there goes my diet.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
I know you are a healthy eater. But, every now an then I have a hankering for some "bad" food, and burgers are at the top of that list.
Doc has me on a low to no red meat diet, so I don't eat burgers as often (or steaks for that matter), but I think that might change for lunch today.
-- rants are the vehicle of the lazy and uninspired - JSOP 2/2018
|
|
|
|
|
I kid you not: try Tofurkey Italian Sausage[^]. Diced, for example, and it looks and taste perfect in meatless "Roast Pork" Fried Rice.
We're talking about an incredible equivalent to Pepperoni in almost every way - except the ingredients. Best buy is at Trader Joe's if you've one nearby. Also, don't miss their Boatswains Double IPA (8.4%, and smooth). The other items in the family are rather so-so, but this stuff is fine.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
"It Depends" - what about "other" or "neither" ?
I prefer
if (condition) {
statement;
}
The opening 'curly bracket' at end of statement and closing 'curly bracket' aligned with the beginning of the statement.
Why Oh Why, Mr. Survey-Taker, do you so often skip the obvious? Reminds me of how political surveys are taken, designed to get the answer they want instead of the actual answer.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
That is usually the format for java/javascript. C++, etc. too, perhaps.
However, in all my years of working with C#, I have never worked at a shop that allowed your preferred way for C# coding in particular.
-- rants are the vehicle of the lazy and uninspired - JSOP 2/2018
|
|
|
|
|
This is exactly how we code where I am employed. Take the default VS install options, and put the leading brace on the first line. Then change the default spaces from 4 to 3. Not sure how those two options became the two changes.
|
|
|
|
|
So, you should have voted for 2nd option.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
"Neither"? Possibly, although I might have tried to be more positive and voted for "Other", instead.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
W∴ Balboos wrote: Neither No, the question was simply if there should be braces or not, not where the braces should go. Your example showed braces so you should vote the 2nd option.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Survey said:
One war at a time. Do you believe everything you read on the internet?
Take some artistic license . . . the compiler/interpreter doesn't care what kind of spacing you use. Don't let one of life's great opportunities pass you by.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
W∴ Balboos wrote: One war at a time. Exactly my point.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
You pick your wars, I'll pick mine.
Tomato, potato.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Fanbois, all of you!
I have spent the weekend with refreshing assembly. And what do I have to see here? You guys probably would hate it, because there is not very much you could argue over and no company that provides you with a style guide that is at least as thick as the famous Spanish Court Protocol.
Instead you would be forced to actually think about what you are doing.
I have lived with several Zen masters - all of them were cats.
|
|
|
|
|
CodeWraith wrote: think about what you are doing posting.
FIFY
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Note the explanation under the heading: "It's just about the braces. Not about whether the leading brace should or should not be on the same line as the conditional. One war at a time."
I chose "It depends" instead of having 15 other options purely to focus the debate on the important question and not let it get dragged off into the weeds.
cheers
Chris Maunder
|
|
|
|
|
Chris Maunder wrote: I chose "It depends"
and you'd be wrong Maunder.
like those people who say "haitch" instead of "aitch" for the letter "h" - they need..."correction"
Bryce
|
|
|
|
|
You, then underestimate the important question, to wit:
"Do they do it my way or the wrong way".
All other questions just paraphrase the above . . . trust me on this.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Especially without any comments:
condition && statement;
|
|
|
|
|
if(condition) statement;
Single/simple statement, and it's not a loop (for, while), might be put on the same line.
And never ever do;
if(condition) { statement; }
By the way, Alt 1 ought to be punishable ...
The number of "code fixes" I've seen in the form of;
if(condition)
statement;
being changed to
if(condition)
statement;
statement;
In one project I even found three statements ... Be safe, use BRACEs.
|
|
|
|
|
Alternative 3 is my favourite too.
|
|
|
|
|
{} are called braces, not brackets. Brackets are these things: ()
Anyway ... I prefer a language where they're not needed at all!
If condition Then ...do something
|
|
|
|