I have been using the default of new line for methods and code blocks but it’s using up a lot of space. Should I use the curly brace on the same line as the start of the method? Is there any disadvantage to doing this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Disadvantage of putting the opening
{on the same line: some people don’t like it, and some people find it harder to read.Disadvantage of putting the opening
{on the next line: some people don’t like it, and it takes up more vertical space.I think next line looks prettier, but I don’t really find it easier or harder to read assuming the code is indented nicely.
If you are working in a team with standards mandating one or the other then you should follow the standard, otherwise do whichever you prefer.