Posts

Showing posts with the label scope

Treehouse Intermediate Course - Part 11 (Closures 2)

Image
So, as expected, I had to miss two days. But I'm back! I have a bit of time this evening to carry on with closures - certainly, completing the first part of the Treehouse track. So far, it's all been fine and I haven't found any issues. OK, let's go! Start Time - 18:56 func gameCounter() -> IntegerFunction {          var localCounter = 0          func increment( _ i: Int ) {         print ( "Integer passed in: \ ( i )" )     }          return increment } So just a reminder of scope. The localCounter variable is local as it is inside the body of the method; it can't be used outside that function.  *Paused at 19:03 (not able to concentrate - need to come back to this to take it in properly.) *Continued at 20:11 The increment function now has localCounter += inside it. It can use the localCounter var as it is defi...

Ray Wenderlich Course Part 7 (up to lesson 62)

First of all, I DID IT! I managed to use if statements to program in a maximum with five rounds and the total score being shown. Wasn't easy but I did it! func nextRound() {                          score += points             roundNumber += 1         }                  if difference == 0 && roundNumber < 5 {                          title = "Perfect!"             points += 100             nextRound ()                      } else if difference < 5 && roundNumber < 5 {             title = "Very close - great try!"             ...

Angela Yu Course Part 6 (up to lesson 84)

Image
Yes - the first time not in the evening for a short while that I've been able to code. Here is my plan for the next couple of days: Complete Section 8 - Xylophone app! Make my own 'Yahtzee' app - this could take some time... Complete Section 9 - MVC for make a quiz app This will be plenty to sink my teeth into. Ok here goes! Introduction The aim is not so much about creating an app but actually using tools to get help - whether it's using the Swift documentation or other searches. There will be unfamiliar language etc. The purpose is to be more self-reliant - this is something I DEFINITELY need! When I need a certain functionality - finding out for myself. This will be key! There's no point just copying and pasting someone else's code without understanding it; it's much better to find things out and then apply them. Anyway, here goes! Using Tags Linking all of the buttons to one action....interesting! So they all trigger the same action. Usin...