In C, 'if' is a keyword and a space always follows a keyword.
Exception: `typeof` in C# (`typeof(Object)`, for example).
21–30 of 32 posts
In C, 'if' is a keyword and a space always follows a keyword.
Exception: `typeof` in C# (`typeof(Object)`, for example).
function(...) conditional (...)
I don't recall which I do, but I do know that I use less space in general nowadays than I did before syntax highlighting was basically everywhere. Anyone else change their style due to syntax highlighting?
So I really prefer, for example,
if have_taste?
...
or unless stuff =~ some_regex
...I personally prefer if( test )
This is my personal preference too. I like that the condition is visually separated from the wrapping. I'm also prone to borderline-too-complex conditions, and this syntax makes those easier to focus on.
Braced languages annoy me because every developer seems to have their own "special" brand of stupid formatting. Some perfect examples of this thinking are right here:
http://en.wikipedia.org/wiki/Indent_style#Horstmann_style
http://en.wikipedia.org/wiki/Indent_style#Whitesmiths_style
Think about basic writing people. Would you decide not to put a space before a parenthetic statement(obviously not)? Or like one comment suggested, you would never put a space after the opening or before the end ( unless you are just being ironic ).
It doesn't matter how you think it looks, it matters that you are trying to be different for the sake of being different. Stop it.
Earlier quoted context omitted.
This is my personal preference too. I like that the condition is visually separated from the wrapping. I'm also prone to borderline-too-complex conditions, and this syntax makes those easier to focus on.
Do you also write that way ( if you know what I mean ).
Most non-code writing is going to be read linearly, rarely more than onc. Parentheticals in a reading context are secondary, not deserving of additional emphasis that they get in code.
function(...) conditional (...)
And do you also add the space before the paren when you declare a function? I ask because a conditional block is often closer syntactically to a function definition than it is to a function invocation, yet I hardly ever see anyone put a space before the paren when defining a function.
y = f(x)function(...) conditional (...)
And do you also add the space before the paren when you declare a function? I ask because a conditional block is often closer syntactically to a function definition than it is to a function invocation, yet I hardly ever see anyone put a space before the paren when defining a function.