Checking of presence of an arrays element in Swift
Forums:
let numbers = [2, 3, 5, 7, 11, 13, 17]
let contain5 = numbers.contains(5)
//contain5 is true
let contain10 = numbers.contains(10)
//contain10 is false
- Log in to post comments
let numbers = [2, 3, 5, 7, 11, 13, 17]
let contain5 = numbers.contains(5)
//contain5 is true
let contain10 = numbers.contains(10)
//contain10 is false