T
Thomas W.
hash = {}
hash[:key] = myvalue
How to assign hash[:key] only if myvalue is not nil?
Current solution is:
hash[:key] = myvalue unless myvalue.nil?
Is there something more beautiful?
hash[:key] = myvalue
How to assign hash[:key] only if myvalue is not nil?
Current solution is:
hash[:key] = myvalue unless myvalue.nil?
Is there something more beautiful?