MCQs>IT & Programming>Swift>The example below defines two variables, movieCount and songCount, which count the number of Movie and Song instances in the library array?
Swift MCQs
The example below defines two variables, movieCount and songCount, which count the number of Movie and Song instances in the library array?
Answer
Correct Answer: var movieCount = 0 var songCount = 0 for item in library { if item is Movie { ++movieCount }else if item is Song { ++songCount } } println("Media library contains \(movieCount) movies and \ (songCount) songs")
Explanation:
Note: This Question is unanswered, help us to find answer for this one