I tried to use unless operator with side-effects, and I was surprised that it doesn't short circuit.
potato_card: deck.add["card" "potato"] unless deck.cards["potato"]
The above creates a new card regardless of whether a "potato" card exists. I was hoping that the left term would not be evaluated (a.k.a short-circuits) if the right term was not nil.
Is there a better (more idomatic) way to get this short circuit behavior? This is what I'm currently doing:
potato_card: if deck.cards["potato"] deck.cards["potato"] else deck.add["card" "potato"] end
Thank you!