The consequence appears to be strStatResult / 2 - 5
. This works with integer division. Each 10 / 2 and 11 / 2 give 5. Subtract 5 and also you get 0, identical to your large swap assertion.
Assuming strStatResult
is an Int
(or different integer sort), all you want is:
if strStatResult < 1 || strStatResult > 30 {
strengthModLabel.textual content = "Error"
} else {
let num = strStatResult / 2 - 5
strengthModLabel.textual content = num > 0 ? "+(num)" : "(num)"
}