2 ms·
Who even programs like this? If I saw that expression in code I think I’d have a fit. I love Ruby for lots of things, and even with its duck typing system I’d
by crazydoggers 5y ago
Who even programs like this? If I saw that expression in code I think I’d have a fit.
I love Ruby for lots of things, and even with its duck typing system I’d never see someone plop down stuff like that. Ruby’s got quo, fdiv, divmod etc for good reason!
So is this contrived, or do people encounter programmers who do this stuff on a regular basis (not newbies, like experienced people… this feels like programming 101 to me)
- vidarh 5y agoI love Ruby too, but "/" giving integer results when both sides of the expression is integer is a frequent source of error, and I'm not convinced it's a good choice - in my experience at least it is rarely (though sometimes) what people want.
- meowface 5y agoThis is why Python 3 changed division to return floats rather than ints. ("//" retains the old floor division behavior.)