Posts

Showing posts with the label parameter labels

Stephen DeStefano Swift 5 Course - Part 3 (Lectures 8 to 11)

Image
Well it's been a good few days but I'm back! No need for more of a preamble than that - straight into functions! Start Time - 14:06 Functions These are SELF-CONTAINED. It is best to name what the function actually does. Syntax - the name, parameters, return bit etc. Nothing else new here. Bit about the return value and print statement used. Underscore - placeholder for a constant/var without an actual name. 9 out of 10! Only one that was wrong was a bit of a trick question. OK next! Returning Multiple Values So this of course means returning a tuple All very technical - again, Stephen combines lots of elements - for loops, if statements, optionals...all hard to keep on top off! Names of return types - optional. Used to improve readability of code. Argument Labels and Parameter Names Argument label - used when calling the functions. Better for readability. Swift used the parameter name as the default. Labels are used on the outside - on the left of th...

Sandra L Course Part 3 (lectures 16 to 22)

Image
Well it's been a good few days! After so much success with my first proper app, it's been a shame not to capitalise on that. Having said that, I do feel recharged and ready to learn some more! My plan with Sandra's course is to keep with it for all of the recap. When it starts getting trickier, I'm going to work on an Xcode project for another app idea - got a few possibilities! So, let's continue with Sandra's course! Start Time - 13:29 Parameter Labels func add(number1: Int , number2: Int ) -> Int {          return number1 + number2 } add (number1: 4 , number2: 6 ) Again, easy stuff. The next step here is to use _ to have empty parameter labels.  OK - one useful distinction here between parameters and arguments. The argument is the external name - the one used outside of the code block. The argument label should read as a sentence e.g. using 'to' instead of 'name' in a sayHello function.  So "say hel...