EDU Course Challenge 2

So, as mentioned before, rather than cracking on with Angela's more complex course, I'm spending some more time on consolidation and application. A couple of things with this EDU course - it's quite outdated so not ALL is relevant; it has made me learn a few new things; it's an excellent way to tackle practical challenges. This time I'm not heading straight in, but - like the last few Rick Walter bits - going over some of the content. Skipping through if necessary. 

Start time - 9:18

Functions

There's a mention here of default and variadic parameters. The variadic part I'm not so sure about so am going to check up on this. 

So default values - you can set this within the parameters. So if it's there, you may e.g. have two possible ones with one of the values set. 

Suppressing external names - using the _. 

A variadic parameter is one which can have multiple values in it.  It's the use of the ... in the parameters. 

func sumOf(numbers: Int...) -> Int {
    var sum = 0
    
    for i in numbers {
        sum += i
    }
    return sum
}


That's actually pretty simple. 

Types

All the basic types in Swift are value types. Reference types are different. Still don't COMPLETELY get this aspect of swift. 

The nested function part is confusing and doesn't seem to work with the newer Swift. No point going over it if that's the case. 

Closures

These are essentially a function without the func keyword! 

let add = { (a: Int, b: Int) -> Int in return a + b }

add(4, 5)

So this is a good example. 

Dollar sign symbols - not sure if these are still used. 

These are making my head hurt! I've decided to instead press on with Angela's course, as the content here is unclear and possibly outdated in places. So basically, another entry today using and continuing Angela's course! 

*Stopped at 9:49 - 32 minutes total

Comments

Popular posts from this blog

*Xcode Project Entry 2* F1 Quiz - part 1

Angela Yu Course Part 10 (up to lesson 112)

Angela Yu Xcode 12 Course - Part 7 (lectures 74 to 79)