07/03/19
Prefer composition over inheritance?
Why prefer composition over inheritance? What trade-offs are there for each approach? When should you choose inheritance over composition?
06/25/19
In a Swift protocol definition, what does it mean if there's ": class" after the protocol name?
06/13/19
Safe integer parsing in Ruby?
I have a string, say `'123'`, and I want to convert it to `123`.I know you can simply do `some_string.to_i`, but that converts `'lolipops'` to `0`, which is not the effect I have in mind. I want it...
more
06/12/19
Map and Remove nil values in Ruby?
I have a map which either changes a value or sets it to nil. I then want to remove the nil entries from the list. The list doesn't need to be kept.This is what I currently have:<!-- language:...
more
In Ruby, how do I skip a loop in a .each loop, similar to 'continue'?
In Ruby, how do I skip a loop in a `.each` loop, similar to `continue` in other languages?
Still looking for help? Get the right answer, fast.
Ask a question for free
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Find an Online Tutor Now
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.