Tony Stark Tony Stark - 5 months ago 21
Swift Question

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

I'm learning functions in swift's array and have encountered the following problem.

enter image description here

I copied the code directly from swift's API so didn't expect to have any problem. Can someone please tell me why is it giving out error message when typed in playground?


I believe you're using Swift 2.2 and the syntax you're using is for Swift 3. Try: