Posts

Showing posts with the label Dictionary

*Xcode Project Entry 2* F1 Quiz - part 1

Image
It's Christmas Eve and time to code! To think, a year ago, I was plodding along with some eBook, blindly convincing myself that I was on a steady road to coding greatness. Really, it was from June where I made the decision to start again, humbling as that may seem. It would have been comforting to have completed endless 'beginner' courses but branching out and applying the theory is the key thing, which brings us to this entry. Yes, my second Xcode OWN project! I thought about doing an educational one, as there is certainly a lot of scope and relevance for that, being a teacher and all. However, making a quiz makes sense, for various reasons.  First off, I have made this before through Angela's excellent tutorial. No offence to Sandra, but hers is not even close to the elegance and effectiveness of Angela's project. The one thing to take from Sandra is the stack views. Definitely something I will use from now on. This is one of the great things about learning from...

Collections and Control Flow - Dictionaries

Cracking on with the Collections and Control Flow course - yes I'm continuing the momentum! Will hopefully be able to stay ahead of target and complete this (well, recap and go over!) course before the weekend! Dictionaries - Introduction The main distinction between these and arrays is that dictionaries are unordered. The example that Pasan gives is with airports e.g. DXB: Dubai. As these are both strings, they will need speech marks around each of them. So the key-value pair is a string-string pair. The syntax is straightforward. A colon is used to separate the key from the value and each key-value is separated with a comma. Now in the results bar, the order is not the same! This proves that the dictionary is an unordered set. The order can also change - the reason is because an order is not needed! Only use a dictionary if the order is not important. You can make it more literal by putting in the String:String key:value pair in the square brackets; this is again all part o...

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...