Hello, welcome to the 10th tutorial in the swift basic series and in this program we'll look at the for in loop. If you watched our previous tutorial on for loop, you'll know that loops are useful for repeating code. The example will be very similar but you'll be able to see how the for in loop for certain circumstances, especially the one that we've demonstrated in the previous tutorial, it can be more useful for that let's just open up our project was going to quickly create an array called the high score equal to 100. And it says 730 for 500 there and there's a number for it. What you can do is score in high school. This is Variable score here, slow, temporary variable, you can name it whatever you want.
Obviously, this here has to be the array that you're trying to loop through. And what this will do is it will automatically create the iterator or whatnot. And every time it loops, it will assign as the value at index zero to score, then index one to score that index to score next read score, and therefore score one also on different lists. So you can simply do print ln, if we just print out the score like this, and we run it, it has all the score printed and we have to do any iterating yourself, which is really cool. Often for notice, if I try and put brackets around here and run it, well, you can't have brackets. You need to just have it with their brackets which is weird.
Then why because the for loop led to and so do the other loop book. can use one of those things. I guess. That's it for this tutorial. Don't feel any questions feel free to message your support Asana system cutter UK. The email will be in the description you can comment on this video or directly messaged us via YouTube.
In the next tutorial when I look at the while loop or the requirement for source code will also be in the description and as usual, thanks for watching and have a nice day.