Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJohn Wilcox
4,233 PointsWhat on earth does this mean??
'cannot subscript a value of type '[String]' with an index of type '
Honestly. I can't figure out what is going on. Can someone please advise? I did my optional bindings and am trying to access the Actors array. Ugh.
let movieDictionary = ["Spectre": ["cast": ["Daniel Craig", "Christoph Waltz", "LÊa Seydoux", "Ralph Fiennes", "Monica Bellucci", "Naomie Harris"]]]
var leadActor: String = ""
// Enter code below
if let film = movieDictionary["Spectre"] {
if let castArray = film["cast"]{
leadActor = castArray[0] {
}
}
}
1 Answer
miikis
44,957 PointsHey John,
You almost got it. Just remove the opening and closing braces after you set the leadActor. Not sure why you put them there.
John Wilcox
4,233 PointsJohn Wilcox
4,233 PointsOh man. Yep that would explain it. Thanks sir,