3 ms·
So someone would expect that an int cast of "2" would be 2? What would an int cast of "a" be?
by StavrosK 11y ago
So someone would expect that an int cast of "2" would be 2? What would an int cast of "a" be?
- dalke 11y agoI'll add to that - In what "normal langs" is this not a problem? What would a C or C++ programmer expect? Because my experience in those languages says "casting" is a meaningless way to understand what's going on. Perl doesn't have bareword true/falue values. Ruby doesn't use "casting", I think. That is, I think the idiomatic way to express this in Ruby is: >> !!true.to_s => true >> !!false.to_s => true