Whether you like to hug the open brace (example 1) or put it's on it's own line (example 2) is a matter of personal preference - both are correct. However, you really need to line the closing brace up with what started it.
Lining up the braces with keywords is also a matter of personal style. I do it and I wish every one did. Unfortunately, some people don't. Really, it's all a matter of style and there is no correct or incorrect way to do it. I think the real important thing is consistency.
Also, i recommend using tabs instead of spaces
I strongly disagree with this. Use spaces. Tabs just end up being an additional hassle for the programmer. Tabstops have to be set correctly in order for the code to look good. That's not a huge problem but it is an annoyance. The real problem occurs when a tab-using programmer comes along and modifies source code written by a space-using coder (or vice-versa.)
So, once again the answer is consistency. The reason I advocate spaces is that they are inherently consistent and do not rely on an editor or terminal variable as tabs do. A space is a space is a space whereas a tab is eight spaces or maybe four or perhaps two or possibly three and sometimes six... etc.
I know some people advocate using tabs for indentation and spaces for alignment. In my estimation, that's only half a solution. Worse, it creates its own problems later when the code needs to be maintained.
I'd break my tab key off if I didn't use it for completion in my shell.
-sauoq "My two cents aren't worth a dime.";
In reply to Re: (jeffa) 2Re: Losing or overwritting values
by sauoq
in thread Losing or overwritting values
by sulfericacid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |