Programming in Kotlin - Part 39: Higher-Order Vs | Ray Wenderlich

Learn the difference between lambdas and higher-order functions.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4736-programming-in-kotlin/lessons/39

Audio is Missing after 0:33. I was really looking forward to the explanation, so I am a bit disappointed.

@fr3qfly The instructor doesn’t talk while typing but explains the code afterwards.

@shogunkaramazov that’s not what I meant. For me the video goes silent once the coding screen comes up. And it stays silent till the end. If I go back before the coding screen came up. The audio is back.

@fr3qfly The video works in Safari without issues for me, what browser do you use exactly?

@shogunkaramazov In Chrome 71.0.3578.98, the sound of right ear has gone. I can listen the sound only on left ear.

@getogrand Thank you for the heads up. It works without issues for me in Safari, Chrome and Firefox. Does this happen to you in other browsers too?

@shogunkaramazov It doesn’t work well on Safari too. Try to play after 30sec.

Is there an equivalent to @escaping attribute in Swift, or capturing local variables? For instance:

let localVariable = ImportantClass()
func exampleFunction(operator: @escaping (Int) -> String) {
    // Do stuff.
} 

 exampleFunction { [localVariable] in
     // Do stuff.
 }

One of the nice features of Kotlin is that you don’t need to use things like @escaping. Variables are captured by default if you use them.