Posts

Showing posts with the label switch statements

Nick Walter Challenges (Part 3)

Image
Soooo before going back to Angela's course, I want to go through the rest of these Nick Walter challenges. They've been good fun and very simple, yet encouraging that I CAN apply what I know.  Start time - 13:39 Switch Statements // 1) Make a switch for a double constant with at least 3 cases and a defauly // 2) Make a new swtich that has multiple matches // 3) Make a switch that uses interval matching OK, looking ahead, I'm not familiar with the terms multiple matches and interval matching. Good - something to learn and look up! Let's look within Nick's course first.... Right I got that - multiple matches I have seen before - it's when there are a few matches in one line which can return the same string. Interval matching is what I suspected it was - using the 1...5 range or 1..<10 etc. Right let's go! //1) let number = 7.5 switch number {      case 7.3 :     print ( " \ ( number ) is too low!" ) c...

Chris Ching Course Part 1 (Data types, If/Switch statements, Loops and Functions)

Here we go! Back to Udemy and consolidating with this course from Chris Ching. Spending a couple of weeks on Treehouse has not proved fruitful, though it was interesting to look at properties, initializers and a few other aspects at a higher level. Anyway, coding is one of these things where my understanding needs to be topped up. A bit like going to the gym! Some bits will be intact but I need constant topping up to make it at its optimum.  Start time - 15:02 Data Types *Just skimming over this! Different types of data are stored on the data differently. If the system knows it is an int, then it allows different things to a string, double etc. Type inference - he hasn't mentioned this but there is no need to specify the type. Xcode figures that out. Converting types - var number = 4 number = String(4) var/let - know all about these. Rounding function. Use the round() with the variable in the brackets. If Statements *Again, skimming through! Something I nee...