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
end
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.
https://crystal-lang.org/reference/syntax_and_semantics/as_a_suffix.html