Run is helpful for such a case because you can use it with safe access. If the receiver, window in our case, can be null, then you can't use with because this will be null-able inside the lambda, then these can't be admitted, you will need to explicitly check whether it's not null. Run is very similar to with but it is defined as an extension, which makes it possible to use it with a null-able receiver. Here we can access members of window without explicit specification. ![]() What is the difference? We've already seen with, it takes an expression as an argument and uses it as the receiver inside of the following lambda. I'll try to show you briefly when each one might be used and why we do have so many of them. There are many similar to with functions defined in the standard library. In this video, you'll learn more library functions similar to with that look like built-in language constructs but just take lambda, lambda was a receiver as an argument. We'll discuss: basic syntax, nullability, functional programming with Kotlin, object-oriented programming with Kotlin, the power of the Kotlin standard library, and Java interoperability. Note that this course won't cover the programming fundamentals. The course is based on your Java experience it shows the similarities between the two languages and focuses on what's going to be different. We'll have a basic overview of the language, as well as a discussion of many corner cases, especially concerning Java interoperability. This course aims to share with you the power and the beauty of Kotlin. Kotlin code might be compiled not only to JVM bytecode but to JavaScript and Native code as well, but this course is focused on Kotlin/JVM. It’s a pragmatic language with a very low learning curve, and can be quickly grasped by Java developers. ![]() Kotlin is 100% compatible with all existing Java frameworks, and has good tooling support. It can be used almost everywhere Java is used today: for server-side development, Android apps, and much more. Kotlin is concise, safe, pragmatic, and focused on interoperability with Java code. The Kotlin programming language is a modern language that gives you more power for your everyday tasks.
0 Comments
Leave a Reply. |