You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry for the delay with this one. @twostraws I found a possible typo in the original file, in the section
"## Force unwrapping optionals" there is a function as follows:
func yearAlbumReleased(name:String)->Int?{
if name =="Taylor Swift"{return2006}
if name =="Fearless"{return2008}
if name =="Speak Now"{return2010}
if name =="Red"{return2012}
if name =="1989"{return2014}returnnil}varyear=yearAlbumReleased(name:"Red")
if year ==nil{print("There was an error")}else{print("It was released in \(year)")}
The explanation below it:
That gets the year an album was released. If the album couldn't be found, year will be set to nil, and an error message will be printed. Otherwise, the year will be printed.
I understand that what you are passing to the function when calling it is the name of the album not the year. What I understand from this sentence "That gets the year an album was released" is the function receives the year, which is not right. Am I wrong in this one?. If not, then probably it needs to be changed. What do you think?.
The text was updated successfully, but these errors were encountered: