> How is it /really/ done?

How is it /really/ done?

Posted at: 2014-12-18 
How is this really done

if(blah){

}

OR

if(blah)

{

}

I have learned it both ways, but if i worked at a company or went to school how should i do it?

If you work for a company, follow the way they use. For school, whatever way you see in their example codes. It makes for very messy code to use both methods in the same project.

I personally use:

if (blah){

}

I like the space between the if and the (blah), but not the (blah) and the {

Again, personal preference.

For schoolwork, your coding will be usually an individual matter, unless you are

part of a team doing a team project. In a company you will usually be part of a team.

So your code should be (as much as possible) like the other team members in style.

The goal is that each member of the group ought to be able to read others' code

easily, and to edit it easily. So that's why you shouldn't stick out.

>

> John (gnujohn)

It doesn't matter at all as long as you follow the code style guide for the code you submit. I use both styles quite frequently depending on the code I work with.

My personal opinion is to use

if (blah) {

and the spaces are important.

Either way is fine. It is all a matter of preference and style. As long as you are consistent.

How is this really done

if(blah){

}

OR

if(blah)

{

}

I have learned it both ways, but if i worked at a company or went to school how should i do it?