Hello, welcome to the 12th tutorial in the swift basic series and in this part we're gonna look at the do while loop the LED code to be repeated helping these code and what we'll do while loop is run at least once as the condition check isn't done until after each iteration so let's let's go ahead and open up our project and show you how it works. This is actually a loop which I find and I think a lot of developer find they won't use as often some of the others like for loop while loop. You do use the keyword do doc left on vent do curly braces and then you put your condition here. So while on the oil less than five are employed. do while loop When I run this, when it is running at once, what you might think is why that ronnie wants a white hand to running multiple times?
Or why you what you might think and why. Why is he running at all because the conditions say the only while i is less than five is because it runs the code and then you check for the condition. So you will always run the code at least once. So if I were to put four here and there on it, is constantly looping around, because I'm not affecting I anymore, I'm not affecting the at the end of the loop and or anything like that. Plus is always less than five. But that's it really, that's the main core fundamentals of a do while loop.
It will at least run once not say something that you probably won't do that often on somebody's list but sometimes can come in handy. That's it for this tutorial. In the next tutorial, we're gonna look at the switch statement. Very similar to the if statement and the if else if and else statement. If you have any questions feel free to message us at support Sona system that calm Okay, the email will be in the description. You can comment on the video or directly messages via YouTube or the requiring full source code will also be in the description.
As usual. Thanks for watching and have a nice day.