Posts

Showing posts with the label For

Ray Wenderlich Course Part 8 (up to lesson 70)

Image
Second entry today - woohoo! Cracking on with Ray's guide to all the key language features of Swift. First up will be control flow for 8 lessons then 9 for functions and optionals. I want to get at least all of those done in this entry. Hopefully there will be some more challenges as these undoubtedly help me understand the information at a greater depth. I'm going to be going through the main info at a quicker speed: 1.5 x again. Ok here we go! While Loops var i = 1 while i < 10 {          print ( i )          i += 1 } In this example, numbers from 1 to 9 will be printed.  So the difference with repeat loops is that it executes the code the first time, no matter what... repeat {     print ( i )     i += 1 } while i < 10   Ray says that the first one is used generally more.  repeat {     print ( i )     if i == 5 { ...

Collections and Control Flow - Loops

The momentum continues! It's been really rewarding being so productive and regular with my Swift work. Something I did yesterday - which I am wont to do - was purchase a course from Udemy. I've done this many times before - been naive enough to believe that this is the solution to my problems: a new course! I've counted around 24 courses I've purchased - pretty much all of which are incomplete or barely started! So, the new one I bought because it was only £10 and has a LOT of content on it. I will switch to this, and do some of the others I've bought before, when the time is right to move on from Treehouse... For In Loops These can be VERY difficult to understand. For now, Pasan explains that a loop will happen until a condition is met. There are many real life examples of this. A loop is something that does something over and over until it has done so for each item in a group. On a sidenote, I've for the first time realised how you add another page to ...

What I know about Swift - Part Two

I don't know how many parts I will need for explaining what I know about Swift - this may be the last one! Another note - I'm writing this without ANY reference to Swift documentation/information - it is a pure test to see what I know! In the previous entry, I described how I went about learning Swift, with the timeframe that included the learning-forgetting-relearning cycle, which I am desperate to break. Last time it was the basics about variables, constants, numbers and strings. This time it gets a little more complicated... Boolean I believe that this comes from the (mathematician?) George Boole, who worked with absolutes: true or false. To apply this to Swift, it could be to find out whether a calculation is true or not. E.g. 7 > 4 would return "true" Using the <, > (along with the = for each) symbols means that you can test to see if a value is greater than another. Conditionals The above directly links to the use of the if/else stateme...