Im trying to test if a number can be divided evenly by a group of numbers. This is my code:
var arr = [2, 3, 4, 5, 6, 7, 8, 9]
var text = Int(textField.text!)!
if text % arr === 0 {
}
What i'm trying to do is divide variable "text" by 2, 3, 4, 5, 6, 7, 8, and 9 (if it's divisible by any, perform the action) but i'm unsure how to get the value of the array. And I do not want to have to do:
if text % 2 == 0 || text % 3 == 0 || text % 4 == 0
etc...