Loops – Swift Playground – pt 6 (Comp Tech)

Hello everyone! Today I will be going over a problem I did in the “Swift Playground Learn to code 1” .

We have the “for” statement, which happens three times, and we repeat the move forwards, collect the gem, move forward twice and then turn right. At the end, instead of doing it again, I just moved forward and collected the gem. The “for” loop tells our character to repeat the stuff in the loop three times, and this is easier than doing lots of functions then repeated them once we get into bigger stuff.

And there you have it, the solution to one of the problems. It was fairly easy, and there was nothing really challenging about it.

I hope you all are well.

Leave a Reply