Shorthand for: return if not nil
ruby
Solution
I use this:
@var ||= begin
# ...
end
Problem
I use variable caching to cut down on execution time like so: ``` def some_method return @var if @var [some other code that gets executed only once] end ``` Is there a shorthand for `return @var if @var` ? If its a single line method I use: ``` @var ||= [some more code] ``` Can something similar (short) be done with multiline methods?