swift array method "starts(with:)" causing value of type "Range<Int>" has no number "starts" -


i'm learning functions in swift's array , have encountered following problem.

enter image description here

i copied code directly swift's api didn't expect have problem. can please tell me why giving out error message when typed in playground?

i believe you're using swift 2.2 , syntax you're using swift 3. try:

print(a.startswith(b)) 

Comments