+ 1
Should you space out expressions?
I'm used to writing stuff with mathematical operators like this: sum=foo+bar; Is it better to keep this habit or to make a small effort and get used to writing like this: sum = foo + bar; ?
4 Respostas
+ 5
It doesn't matter, it doesn't even improve readability that much, just use the version you're most comfortable with.
+ 1
some IDE's have an option to format the code which spaces out expressions, so if you're using one of those, there isn't much need to worry
+ 1
As long as you're consistent throughout the code, it should be okay either way.
0
In my own opinion, readability is quite important, and whitespaces are "free" anyway, so I prefer using spaces, even if it is a simple mathematical expression. In terms of readability, it is definitly better than the first.