4 ms·
but because of sane notion of falsiness in ruby, it's easy to both always have a string on unchecked inputs "abc".slice(4, 10) || "" _and_ check those input
by codesnik 2y ago
but because of sane notion of falsiness in ruby, it's easy to both always have a string on unchecked inputs
"abc".slice(4, 10) || ""
_and_ check those inputs in one go if needed.
substr = "abc".slice(start, len)
raise "wrong inputs" if substr.nil?
just that one feature (only nil and false are falsy) of ruby makes it positively stand out among all the languages that have "null" as concept