I am using Swift 2.
I used this code:
while contains(currentCardValues, randomNumber + 1) {
I am getting this error:
"contains" is unavailable: call the contains() method on the sequence
This is because the contains()
method is defined in a protocol extension of Sequence
.
So you should call it this way:
currentCardValues.contains(randomNumber + 1)
Please check this code:
let array = [34, 56, 76, 77, 75]
if array.contains(34) {
print("contains")
}else {
print("Not Contains")
}
Here contains() returns bool value
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With