Yeah, nine months into my first position as a professional developer… totally missed what was wrong until I saw the comments… sigh, what else has gotten through my PR reviews…
Also, I tend to say true == variable, that way I get a compile error if I mess up.
And perfectly fine in a lot of languages (c, c++, Java, JavaScript)
The value of an assignment is the assigned value. So a=b will assign value of b to a, and (a=b)==b will be true.
This is also why things like a=b=c=d=1 work: will assign 1 to all of the variables a,b,c,d (first assigning 1 to d, the n assigning value of (d=1) to c, and so on
View all comments
Show parent comment
9
u/ClikeX Feb 03 '22
It's perfectly fine in Ruby.