Lynda Course - Swift 5 Essential Thinking (Part 4)
Am smashing through this course and enjoying it! Probably because it's mostly recap and consolidation. Anyway, got a bit of time before a brunch today so no time to waste! Start Time - 11:26 5. The Wide World Of Functions So a point here is that a lot of these are already built into Swift. But we can create our own of course! Basic functions All good recap here. Overloading functions Heard of these once before in Pasan's story course. So this is using the same name for multiple functions, as long as their signatures are unique. // Base function func attackEnemy() { print ( "Attacking enemy..." ) } // Overloaded functions func attackEnemy(damage: Int ) { print ( "Attacking enemy; \ ( damage ) caused" ) } func attackEnemy(damage: Double , weapon: String ) -> Bool { if damage > 8.4 { return true } else { return false ...