|
|
|
|
|
by psyklic
3623 days ago
|
|
Interestingly, assignment inside conditionals is usually avoided because it is easy to accidentally do an assignment (=) rather than a comparison (==). Note that for multiple assignment this mistake can no longer happen: irb(main): a, b == 3
SyntaxError: syntax error, unexpected ==, expecting '='
Should it still be avoided? :) |
|
I'll respond to your question by asking you a question. Which of the following expressions evaluate to "truthy"?
The answer is in this gist: https://gist.github.com/backus/c9b70dee67470698fd7d4a66ddf03.... Don't peek!