Simple problems which I just can't seem to figure out in my small head. I have a variable which will be updated and increment sequentially i.e 0, 1, 2, 3, 4.. and so on just to be clear. I am trying to implement a condition for when the numbers are 1 and 2 beep and for 3 and 4 do this, this should alternate. let me show you using code.
func doSomething(number : Int) {
//number is increment sequentially: 0, 1, 2, 3, 4...
let number : Int = number
if number is 1, 2, 5, 6, 9, 10... {
//play a sound
} else if number is 3, 4, 7, 8, 11, 12... {
//vibrate
}
}
My concern isn't what happens inside the if statements but the logic in the condition of the if statement.
Aucun commentaire:
Enregistrer un commentaire