3 ms·
You can write in a very similar way in python too if you want to. I think I'd argue this is cleaner syntax, even. >>> foo = 10 >>> bar = foo if foo >
by Twirrim 6y ago
You can write in a very similar way in python too if you want to. I think I'd argue this is cleaner syntax, even.
>>> foo = 10
>>> bar = foo if foo > 5 else 0
>>> bar
10
>>> bar = foo if foo < 5 else 0
>>> bar
0