re: Be careful when memoizing booleans! VIEW POST

TOP OF THREAD FULL DISCUSSION
re: You're confusing the value of a with what the statement a = false if a.nil? is returning. The console prints the output value of the whole stateme...

🤦 Of course. Thanks for the explanation. I'd convinced myself that it was returning the variable's value. Doh!

So, in my case I would use it like so:

  def happy?
    @happy = post_complete? if @happy.nil?
    @happy
  end
code of conduct - report abuse