As a suffix

An if can be written as an expression’s suffix:

a = 2 if some_condition

# The above is the same as:
if some_condition
  a = 2

This sometimes leads to code that is more natural to read.

To the extent possible under law, the persons who contributed to this workhave waived
all copyright and related or neighboring rights to this workby associating CC0 with it.