0 Replies - 827 Views - Last Post: 07 June 2016 - 06:06 PM

#1 thender  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 21-May 16

Simple Swift tutorial error

Posted 07 June 2016 - 06:06 PM

I am just started out with coding, so I'm doing a great deal of books like "Learn Swift in 24 Hours". In the seventh hour of this book, readers are instructed to type this code into a Xcode playground:

import Foundation

let myWord = "Supercalifragilisticexpialidocious"
var numberOfEsFound = 0


for eachChar in myWord {
    if eachChar == "e" {
        ++numberOfEsFound
    }
}

print ("I found \(numberOfEsFound) e's in \(myWord)")





The line for eachChar in myWord { keeps getting red stop signs (error notices) from the Xcode playground. It appears that the use of eachChar has deprecated, along with println.

I have changed println to print (as shown above), but I'm not sure what else to try. I'm not sure what else to try.

Please let me know if I've made a simple error. Thank you!

Is This A Good Question/Topic? 0
  • +

Page 1 of 1