if (condition) 
      DoSomething();
I mentioned this on Twitter and got some interesting responses back from other developers - the main one being that this is probably a language specific question as many languages/frameworks simply won't allow this sort of syntax in the first place.
I have
The other thing that people mentioned on Twitter is that the code above would not be acceptable but if it all sat on one line then it would probably would be alright, like this -
  if (condition) DoSomething();  if (condition) 
      DoSomething();
      DoNextThing();
What is your opinion? Is there ever a valid reason not to add the braces? What happens in other languages?
 
No comments:
Post a Comment