Hacker News new | ask | show | jobs
by userbinator 2755 days ago
But by far the best option is to not have a meeting at all and to not care about things like this.

Indeed. This article reads like someone who doesn't understand inequalities, and proposes a quite possibly hazardous shortcut to it instead. To not understand such basic maths is baffling (this is primary-school stuff), and I wonder at the state of maths education these days to see adults struggling with these concepts.

I have never in over 3 decades of programming ever had to ask myself the question of how to write conditional expressions --- it's something that comes naturally, and in this specific case I would also write it with the variables on the left.

3 comments

Agreed.

That said, I've come across code where the variable is always on the right. This often seems to be a throwback for some devs to alleviate the problem of mixing up equality and assignment.

That is, it seems that some people have been taught to use this expression (& stick to it religiously):

if (5 == x) ...

simply so that if they make a mistake and type

if (5 = x) ...

the (C/C++) compiler will reject it. So, these people always write the slightly more awkward case (imho) of:

if (5 < x && 10 > x) ...

but to me it doesn't read as cleanly, because we don't say it that way.

Of course, there's the problem of understanding the meaning of 'between' which can be inclusive of the end points, or exclusive...and you really can't tell from the english. In every case, it needs to be clarified. (eg 'pick a number between 1 and 10'):

if (x>=1 && x<=10)...

> This article reads like someone who doesn't understand inequalities

Not really the point I was getting at. I don't think the author is stupid, and I don't think their style is hazardous. I think it doesn't matter.

> This article reads like someone who doesn't understand inequalities, and proposes a quite possibly hazardous shortcut to it instead.

This is how I usually write inequalities. Have you considered that possibly the author and I understand how they work and would like a consistent way of formatting them to save time while reading them?