Do you prefer spaces surrounding equals signs in code?

Poll will close on 30 Jun 2026

Dan Dolan
Dan Dolan about 24 hours ago
I think spaces get out of control and only use them to separate logical operations (==, &, etc.). I don't generally use spaces around equal sign but can tolerate them unless someone is using them between every operator, variable, and parenthesis/brace/bracket.
c=sqrt(a^2+b^2) % my preference
c = sqrt(a^2+b^2) % I will allow it
c = sqrt( a^2 + b^2) % too much
c = sqrt( a ^ 2 + b ^ 2) % you are killing me
Rik
Rik on 3 Jun 2026 at 10:41
For code I want to look neat and tidy I prefer spaces, but for quick&dirty code I mix the two (I know, I know).
For == however, I have a much stronger preference for spaces, especially if the full expression is longer than a dozen characters.
Steve Eddins
Steve Eddins on 2 Jun 2026 at 20:34
Without spaces, it appears way too cramped to my eye. I dislike it as much as many of my former MathWorks coworkers dislike underscores. 🙂
var=no;

Tags

No tags entered yet.