3 ms·
> So, "nil" is not a primitive value in Ruby Almost nothing is a primitive value in Ruby. Not even true/false/numbers are "traditional" primitive values. > Le
by spoiler 11y ago
> So, "nil" is not a primitive value in Ruby
Almost nothing is a primitive value in Ruby. Not even true/false/numbers are "traditional" primitive values.
> Let's get back to the example, let's say that checking for «u» would return «nil», wouldn't checking for «u.profiles» would result in an exception thrown nonetheless?
No, because `u.?profile` would return `nil`, then, when you try `nil.?thumbnail` on nil again, it would return nil. So, doing the following, with `u` being `nil` is legal:
if u.?profile.?thumbnail
# doesn't run if u is nil
end