if used as an expression

Here’s the code if you want to experiment with it:

let comment = if Int.random(in: 0...3).isMultiple(of: 2) {
        "It's an even integer"
    } else {
        "It's an odd integer"
    }
Previous
Previous

switch used as an expression

Next
Next

better compactMap