I’d like to do something like this, where based on some condition I decide whether to set a val to another or to increment it. I feel like I’m missing something obvious here, but how would I make this work?
process_wager(@wagers[@street.current][@action.abbrev])
process_wager(@wagers[@street.current][:total])
process_wager(@actions[@action.abbrev])
process_wager(@wagered)
def process_wager val
@condition ? val = @amt : val += @amt
end
I know I could do
@wagers[@street.current][@action.abbrev] = process_wager(@wagers[@street.current][@action.abbrev])
but I am hoping for a tidier way like up above.
Why not: