Could someone explain why the code below:
let artists = ["Brenda and the Del-chords", "Brenda and the Del-chords", "Fizz", "Boom!"]
let durations = [90, 200, 150, 440]
func songInformation(title: String, artist: String, duration: Int) -> String {
return "The song is called \(songTitles) by \(artists) and is \(durations) seconds long"
}
for i in 0 ... songTitles.count - 1 {
print(songInformation(title: songTitles[i], artist: artists[i], duration: durations[i]))
}
returns the following to the console:
The song is called ["Ooh yeah", "Maybe", "No, no, no", "Makin\' up your mind"] by ["Brenda and the Del-chords", "Brenda and the Del-chords", "Fizz", "Boom!"] and is [90, 200, 150, 440] seconds long
The song is called ["Ooh yeah", "Maybe", "No, no, no", "Makin\' up your mind"] by ["Brenda and the Del-chords", "Brenda and the Del-chords", "Fizz", "Boom!"] and is [90, 200, 150, 440] seconds long
The song is called ["Ooh yeah", "Maybe", "No, no, no", "Makin\' up your mind"] by ["Brenda and the Del-chords", "Brenda and the Del-chords", "Fizz", "Boom!"] and is [90, 200, 150, 440] seconds long
The song is called ["Ooh yeah", "Maybe", "No, no, no", "Makin\' up your mind"] by ["Brenda and the Del-chords", "Brenda and the Del-chords", "Fizz", "Boom!"] and is [90, 200, 150, 440] seconds long
I was expecting it to return something more like:
The song is called Ooh yeah by Brenda and the Del-Chords and is 90 seconds long.