Friday, 6 September 2024

scope function in kotlin

 scope functions's sole purpose is to execute a block of code within the context of an object. When you call such a function on an object with a lambda expression provided, it forms a temporary scope. 

In this scope, we can access the object without its name. Such functions are called scope functions. There are five of :-

1.let -> it

2. also -> it

3.with -> this

4. apply -> this

5. run -> this

No comments:

Post a Comment

how to change status bar color in jectpack compose.

 Step1: Go to MainActivity and do following: enableEdgeToEdge ( statusBarStyle = SystemBarStyle .light( Color . Green .h...