For and While loops allow a piece of code to be executed iteratively and repeatedly. I’ve played around with loops before in Python so already have an idea how they function. Transferring the skills from Python to Swift 2 seems relatively easy. Playground allows the code to be run as you are editing and highlights errors quickly, which allows for easy amendments when you mess up.
I played around with While loops implementing and printing information from an array and amending the data – lots of trial and error was involved getting the code to work as hoped, but slowly I’ve been getting there. I also explored some simple For loops, creating code that generates sequences of numbers and manipulates arrays with simple math. The two images I’ve uploaded show screen shots of the code running in Playground and the resulting outputs.
My next challenge is to create a simple app with UI which tells a user whether the number they input is a prime number or not. This time I’m aiming to create the code first in Playground and then implement it into the app. Considering I only starting learning app development a few days ago I feel like I am making good progress – but I’ve got a LOT to learn!