Created
June 27, 2018 00:26
-
-
Save gallaugher/e0eb6e6f23051de91b2f66601113484b to your computer and use it in GitHub Desktop.
Printing for in vs. forEachj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var scores = [83, 85, 90, 100] | |
| // print all array elements with a for loop: | |
| for score in scores { | |
| print(score) | |
| } | |
| print("^for in ^\n") | |
| // print all elements with forEach: | |
| scores.forEach{print($0)} | |
| print("^ for each ^\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment