How do I do the following exercise on for in loops using Swift code? Please explain your reasoning using comments. This is the whole question.
Extracted text: Exercise - For-In Loops Create a for-in loop that loops through values 1 to 100, and prints each of the values. for counter in 1...100 { print(counter) 6 7 8 } 10 Create a for-in loop that loops through each of the characters in the alphabet string below, and prints each of the values alongside the index. 12 let alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 13 for letters in alphabet { 14 print(letters) 15 } 16 17 18 Create a [String: String] dictionary, where the keys are names of states and the values are their capitals. Include at least three key/value pairs in your collection, then use a for-in loop to iterate over the pairs and print out the keys and values in a sentence.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here