3 ms·
I'd like to provide a counter-example here: Ruby allows this construct, enabling me to write x = Post.first ? do_foo(x) : do_bar # does the assignment, then ev
by silversmith 16y ago
I'd like to provide a counter-example here: Ruby allows this construct, enabling me to write
x = Post.first ? do_foo(x) : do_bar # does the assignment, then evaluates the result
A nice shorthand in my opinion, so the python way isn't a cure-all :)
- troystribling 16y agoI think you mean this (x = Post.first) ? do_foo(x) : do_bar