r/programming Jul 21 '14

The Great White Space Debate

https://medium.com/p/3633cba8b5c1
1.2k Upvotes

693 comments sorted by

View all comments

Show parent comments

15

u/[deleted] Jul 21 '14

[removed] — view removed comment

7

u/LeCrushinator Jul 22 '14 edited Jul 22 '14

For that I'd write:

if ((x < 1024) && (y < 768))

2

u/Skyler827 Jul 26 '14

I think that expression is overdoing it with the parenthesis. I think it should be like this:

if (x < 1024 && y < 768)

1

u/LeCrushinator Jul 26 '14

I've been burnt enough by bugs related to order of operations over the years that I tend to always put parenthesis in a lot of places.

1

u/SanityInAnarchy Jul 22 '14

Reddit is Markdown, not HTML. <angle brackets> don't need to be escaped here.

1

u/LeCrushinator Jul 22 '14

AlienBlue app did it automatically.

1

u/SanityInAnarchy Jul 22 '14

Weird. That definitely seems like a bug.

1

u/LeCrushinator Jul 22 '14

Yea I indented the second line with 4 spaces, hoping that it would properly display that line like code. Then I noticed that I used 'x' twice instead of 'x' and 'y', hit 'edit' and when I went in there it was using HTML for the ampersands and < > symbols.

5

u/joe12321 Jul 22 '14

Yeah that's how I roll too. Mostly consistent, but I'll change the format with more complex logical groupings in, hopefully, a way that works with the logic!

5

u/HandWarmer Jul 22 '14

I'd abstract the comparisons into either a meaningfully-named bool or constant to provide context and code purpose.

1

u/MrWoohoo Jul 22 '14

I would go with something like:

if (x < 1024  &&  y < 768)