use `when` for side effects, `if` for expressions