Let, Also, Apply, Run, With - Kotlin Scope Functions

  Переглядів 91,632

Philipp Lackner

Philipp Lackner

День тому

In this video I will summarize for what you should choose which Kotlin scope function.
00:00 - Kotlin Scope Functions
00:30 - Let
05:10 - Also
07:20 - Apply
09:13 - Run
10:30 - With
⭐ Get certificates for your future job
⭐ Save countless hours of time
⭐ 100% money back guarantee for 30 days
⭐ Become a professional Android developer now:
pl-coding.com/premium-courses/
💻 Let me personally review your code and provide individual feedback, so it won't backfire and cost you a fortune in future:
elopage.com/s/philipplackner/...
Regular Android tutorials on my Instagram: / _philipplackner_
Checkout my GitHub: github.com/philipplackner

КОМЕНТАРІ: 176
@AlaaAlbrg
@AlaaAlbrg 3 роки тому
Summary of Scope functions: let: Used to check nulls, also better than simple null check in multi-threading case also: same as 'let' but it doesn't return the last line as 'let', instead 'also' will return the object it was called on and 'not the last line!' apply: helpful function to modify objects, if you want to change in properties of the objects, and it uses 'this' instead of 'it' as we work inside the class of the object run: equivalent to 'apply', but it won't return the object it was called, instead it will return the last line with: same as 'run' but a different signature.
@PhilippLackner
@PhilippLackner 3 роки тому
good!
@trungtrankim294
@trungtrankim294 2 роки тому
Awesome. Thanks a lot man.
@rithulraj3348
@rithulraj3348 Рік тому
*with()* is the combination of *let* and *run* because it does null check also, am I right?
@hazfrd
@hazfrd Рік тому
@@rithulraj3348 nope. In fact run is combination of with & let. Run does check nullpointer (let) and reference with this (with) , after that return the last line a.k.a lambda expression
@hazfrd
@hazfrd Рік тому
@@rithulraj3348 with() doesn't checking null, just for non-null. in case it is null then use let(), in case you want make some operation while checking null then use run()
@codinginflow
@codinginflow 3 роки тому
11:04 sick special effects bro .also { respect++ }
@PhilippLackner
@PhilippLackner 3 роки тому
pow(thanks, 10)
@johnybaby9574
@johnybaby9574 3 роки тому
Hi CiF~!
@codinginflow
@codinginflow 3 роки тому
@@johnybaby9574 hi
@agp1444
@agp1444 3 роки тому
also is very useful in case x = y.also { y = x } - switch values of variables without third variable
@mahdi7236
@mahdi7236 2 роки тому
big brain time😉
@TheMohit987
@TheMohit987 Рік тому
😂😂😂😂 wow
@hieuluu2495
@hieuluu2495 Рік тому
Awsome
@phamhung2263
@phamhung2263 8 місяців тому
why don't we just switch those variables with a third variable. It's more readable
@original_anu
@original_anu 2 роки тому
Simple, crisp explanations ❤
@achalbadgujar9519
@achalbadgujar9519 3 роки тому
Finally a practically helpful explanation of these scope functions
@ganshakumari5196
@ganshakumari5196 Рік тому
Fantastic explanation. Much clearer than most of the online resources, Thanks Mate!
@weather120widget8
@weather120widget8 Рік тому
I really appreciate your teaching style, how you build on topics as you go. Keep up the great work.
@adarshdev3810
@adarshdev3810 3 роки тому
It is awesome you explains concepts so simple. Hats off
@jackli1924
@jackli1924 Рік тому
Awesome video!You explained very simply and concisely. Thanks a lot Philipp!
@TheMohit987
@TheMohit987 Рік тому
Your videos are very helpful. Your way of teaching is simply awesome.
@TheMaciak90
@TheMaciak90 3 роки тому
Very well explained. Thank you mate.
@mirzasohailhussain
@mirzasohailhussain 4 місяці тому
Thanks Philip, you are sharing so much knowledge without any charge. I have seen so many people share only basics and then member only videos
@ziakhan-tk7rk
@ziakhan-tk7rk 2 роки тому
Your tutorials are addictive I watch them repeatedly
@usherg4158
@usherg4158 3 роки тому
o man, I have been reading lots of explanation and still not get it until watching yours. Great example and explanation, thanks for making this video.
@benjaminmorales8624
@benjaminmorales8624 3 роки тому
You’re an amazing dev, thank you for all this effort and please keep it rocking!
@PhilippLackner
@PhilippLackner 3 роки тому
Thanks, will do!
@carloscambon5402
@carloscambon5402 6 місяців тому
You explain very clearly. Thank you.
@ianlipa9826
@ianlipa9826 5 місяців тому
Your tutorials are a big help bro. Thanks!
@zareahmer5949
@zareahmer5949 2 роки тому
You are Great man . Stay blessed
@larrystreehouse1124
@larrystreehouse1124 Рік тому
Simple and Concise explanation. Even though I go self-learning with Kotlin for 1 year, this is great to recall my memory and consolidate my knowledge. More importantly, you show us how to teach and explain the basic concept in an interesting and concise passages with live examples.
@leosvxy
@leosvxy 2 роки тому
thank you! , was so easy to understand your explanations
@EngDesper
@EngDesper Рік тому
Thank you for the great explanation!
@damercy
@damercy 3 роки тому
Hey man. I just learnt Kotlin. Previously I've made a few basic projects in android using Java. Fortunately,I found your channel with some really good resources to learn android dev in Kotlin. Just wanted to say a genuine thank you for putting out such great content. Please don't stop. Power to you! 🔥❤️
@PhilippLackner
@PhilippLackner 3 роки тому
Thanks! You're totally welcome
@firuzaaliyeva5382
@firuzaaliyeva5382 3 роки тому
Was literally just thinking about finally studying these, and you just uploaded. Thanks!
@iJuce
@iJuce 3 роки тому
same wtf
@PhilippLackner
@PhilippLackner 3 роки тому
yes, I can read your mind
@mz-coder
@mz-coder 2 роки тому
@@PhilippLackner LOL!
@lyawileh.a8741
@lyawileh.a8741 Рік тому
Thanks for useful explanation. 🙏
@salimmazariboufares3118
@salimmazariboufares3118 2 роки тому
Cool, that was pretty much understandable by someone who is new to Kotlin.
@Alvin-dg9pq
@Alvin-dg9pq 2 роки тому
Fantastic explanation, thanks a lot.
@tanishqsehgal2593
@tanishqsehgal2593 2 роки тому
Very Well Explained
@akeemaweda1716
@akeemaweda1716 3 роки тому
I already liked the video before watching because it is the topic I had pinned on my todo list to research this week. Thanks Philipp
@PhilippLackner
@PhilippLackner 3 роки тому
Awesome, thank you!
@imagetag4618
@imagetag4618 2 роки тому
Wow. its so much clear understand. thank you. keep it up.
@anvarzaripboyev5730
@anvarzaripboyev5730 9 місяців тому
Thanks bro, it is very usefull tutorial. Good luck!
@rahulchandrabhan
@rahulchandrabhan 3 роки тому
One of the best explanation. Simple and Easy. Great man
@PhilippLackner
@PhilippLackner 3 роки тому
Glad you liked it
@ajaykumarvishwakarma4720
@ajaykumarvishwakarma4720 2 роки тому
Really informative video. Thanks a lot
@indraj6669
@indraj6669 2 роки тому
Great explanation
@FatalRescue
@FatalRescue 3 роки тому
Wow, thank you for opening my eyes. I was just using let as shorthand for the null check and did not realize how useful it actually is!
@PhilippLackner
@PhilippLackner 3 роки тому
yes, let > null-check
@aunghtayoo337
@aunghtayoo337 2 роки тому
Thanks. Philipp
@mahetachirag8395
@mahetachirag8395 2 роки тому
Your tutorial are awesome.
@yuanyuechen2183
@yuanyuechen2183 2 роки тому
Thank you, I really learn a lot from you
@yuripanov9670
@yuripanov9670 2 роки тому
You're the best! Thanks!
@telurasinmontasik2406
@telurasinmontasik2406 Рік тому
Very clear explanation
@koutheirelbehi4384
@koutheirelbehi4384 3 роки тому
This boi is on another level !
@tomaslopez9999
@tomaslopez9999 2 роки тому
Thanks for creating this video.
@techmarinar
@techmarinar 2 роки тому
Thanx man this was very helpful 😊
@ramakrishnavjoshi
@ramakrishnavjoshi 3 роки тому
Thanks for this video, Philipp. :)
@FreeKnowledge
@FreeKnowledge Рік тому
Fantastic explanation.
@r.j.jeninjoseph4975
@r.j.jeninjoseph4975 2 роки тому
Really helpful thanks man
@user-uu8rn6wf4u
@user-uu8rn6wf4u Рік тому
Thank you!! 🤩
@bjugdbjk
@bjugdbjk 3 роки тому
Such a fab explanation, Thanks a ton, You should really do a lot more this kind of standalone videos of advanced concepts of Kotlin, it will b super helpful.
@PhilippLackner
@PhilippLackner 3 роки тому
Thank you!
@alexnovikov1609
@alexnovikov1609 Рік тому
Thank you!
@theonlyarjun
@theonlyarjun 3 роки тому
just what i was searching for, awesome man
@PhilippLackner
@PhilippLackner 3 роки тому
Glad to hear it!
@vibinjoby
@vibinjoby 2 роки тому
Amazing just what i wanted after reading the docs and wondering where exactly all these get used
@themichael8767
@themichael8767 Рік тому
Thank You very much, Sir!)
@walkmn
@walkmn Рік тому
Good explanation for the latest one 😄
@marinbeslo7841
@marinbeslo7841 2 роки тому
your tutorials are just awesome!
@PhilippLackner
@PhilippLackner 2 роки тому
Thanks a ton!
@brucebane7401
@brucebane7401 3 роки тому
amazing tutorial!!!!!
@tyrannus00
@tyrannus00 Рік тому
Schönes Video, gut erklärt 👍
@Qrzychu92
@Qrzychu92 2 роки тому
I don't even programm in Kotlin (fellow dotnet dev here!), but this videos are very cool :) I'd love to have this tuff in C#
@thearpansircar
@thearpansircar 3 роки тому
An absolute psychic. I was going through Kotlin's Documentation and, suffice to say, it confused the fuck outta me.
@mdjahidulislam9205
@mdjahidulislam9205 3 роки тому
I was waiting for it.you just read my mind
@PhilippLackner
@PhilippLackner 3 роки тому
yes, I did
@abuiman5251
@abuiman5251 2 роки тому
Thanks!
@mohammedelamin1563
@mohammedelamin1563 3 роки тому
So helpful 😎
@mohamadalighezelbashyan4482
@mohamadalighezelbashyan4482 Рік тому
Great!! thanks ❤
@RackaApps
@RackaApps 2 роки тому
Super helpful
@daniel_lopes
@daniel_lopes 3 роки тому
O melhor, muito bom os vídeos.
@sudarshanh.s.521
@sudarshanh.s.521 4 місяці тому
this is awesome
@sckly43
@sckly43 2 роки тому
awesome video bru
@mehdiparsaei1867
@mehdiparsaei1867 2 роки тому
The best in the world! I am sure!
@jayeshsuthar5590
@jayeshsuthar5590 3 роки тому
crystal clear....
@dreamer6228751
@dreamer6228751 3 роки тому
Thanks bro, it's excellent video !
@PhilippLackner
@PhilippLackner 3 роки тому
You're welcome!
@andriibibik39
@andriibibik39 3 роки тому
Very Good!
@hirarkiardipratamakiki8777
@hirarkiardipratamakiki8777 2 роки тому
i often use 'with 'to declare componen with viewbinding,such as onClickListener, and etc.
@aneessaleh2870
@aneessaleh2870 3 роки тому
amazing video mate , keep it up please
@PhilippLackner
@PhilippLackner 3 роки тому
Thanks a lot!
@DreckbobBratpfanne
@DreckbobBratpfanne 2 роки тому
i liked to use with eg in viewbinding, because then i can avoid typing the binding variable name xD, also you can use multiple of them within each other what is also pretty nifty
@DeniizDenizDeniz
@DeniizDenizDeniz 3 роки тому
How can you dislike this kind of tutorial 4 people? HOW?
@imnithish
@imnithish 3 роки тому
great vid as usual man
@PhilippLackner
@PhilippLackner 3 роки тому
Glad you enjoyed it
@fourcade7851
@fourcade7851 3 роки тому
Thank You Bro
@PhilippLackner
@PhilippLackner 3 роки тому
No problem
@mandroidx1474
@mandroidx1474 3 роки тому
Appreciated Keep it up❤
@PhilippLackner
@PhilippLackner 3 роки тому
Thank you, I will
@shreyashachoudhary480
@shreyashachoudhary480 Рік тому
Great!
@abdelsttarahmed8821
@abdelsttarahmed8821 3 роки тому
you are legend man i wish seeing you doing a video on Providing offline capabilities with NetworkBoundResource
@PhilippLackner
@PhilippLackner 3 роки тому
I do that in my ktor course on pl-coding.com
@jeffreyrudolph6334
@jeffreyrudolph6334 Рік тому
so much better than the kotlin udacity explanations
@shreyashchoudhary7413
@shreyashchoudhary7413 2 роки тому
Epic!
@highs_and_lows4665
@highs_and_lows4665 2 роки тому
This was explained very well. Udemy eat your heart out!😀 Many thanks!
@pratikchauhan989
@pratikchauhan989 3 роки тому
Good one 👏👏
@PhilippLackner
@PhilippLackner 3 роки тому
Thanks ✌️
@lional4898
@lional4898 3 роки тому
With is useful when using string builder. No need to create new variables. Simply call toString at the end
@rsobies
@rsobies 2 роки тому
in this case number is a property so it is a function. a function can return different results and that's why it is considered as mutuable. inside let block you are dealing directly with a field of the class. 'it' is a field, not a property. so it is immutable
@shidqi100
@shidqi100 3 роки тому
Great video expected man love your explanation, just asking will you make videos outside topic of android and mobile dev in general ex: Ai, web or desktop?
@PhilippLackner
@PhilippLackner 3 роки тому
Not planned right now, but I also don't say I never will. I might do some flutter videos in the next time
@Nithin_Coorg
@Nithin_Coorg Рік тому
Crisp!
@amiribrahim01
@amiribrahim01 3 роки тому
thank you.
@PhilippLackner
@PhilippLackner 3 роки тому
Welcome!
@serhatkarakoca
@serhatkarakoca 2 роки тому
Thanks for video.. Also i see use function. What is the use function? This is also scoped function
@DeepSingh-wk5ts
@DeepSingh-wk5ts 3 роки тому
Thanks
@PhilippLackner
@PhilippLackner 3 роки тому
Welcome
@mohammadamirkanjoori138
@mohammadamirkanjoori138 Рік тому
nice
@soontaek
@soontaek 3 роки тому
I left you some feedback on your previous video (Preference Datastore)
@PhilippLackner
@PhilippLackner 3 роки тому
Thanks, I saw it! :)
@erfansn869
@erfansn869 3 роки тому
thanks
@PhilippLackner
@PhilippLackner 3 роки тому
Welcome
@Alchemist10241
@Alchemist10241 2 роки тому
This video definitely belongs to 5 percent group according to 95/5 rule (80/20 rule). Great and precise job 🚀
@renaldyhiunarto4369
@renaldyhiunarto4369 3 місяці тому
coming from the future and seeing you with beard kinda weird lmao. Anyway, love all your vids
@vigneshdroid1654
@vigneshdroid1654 Рік тому
Hi Bro, Your videos are very helpful for me. You Know Tamil language Bro?.
@erfansn869
@erfansn869 3 роки тому
please create video for coroutines for all function GlobalScoup, withContext, .....
@himanshugoeldelhi
@himanshugoeldelhi 2 роки тому
Try executing that code if some people don't understand what 'let' does number?.let { number = null val num2 = it + 1 } Here 'let' actually saved the global value of number and even in case number becomes null in 'let' block , still 'it' value will remain the same which you defined before
@scottbiggs8894
@scottbiggs8894 7 місяців тому
I never realized before that Philipp looks like the Elvis operator ?: ;)
@nishantpattani3053
@nishantpattani3053 2 роки тому
what is difference between return@let and simple return in let function
@coffeedude
@coffeedude Рік тому
I learnt that you can use 'also' to swap variables but I don't understand why it works. ie: var foo = "foo" var bar = "bar" foo = bar.also { bar = foo } print(foo + bar) // barfoo
How to Implement a Shared Element Transition In Jetpack Compose
16:56
Philipp Lackner
Переглядів 7 тис.
Эффект Карбонаро и пончики
01:01
История одного вокалиста
Переглядів 5 млн
What is the Context? - Android Basics 2023
11:22
Philipp Lackner
Переглядів 45 тис.
Kotlin Coroutines 101 - Android Conference Talks
24:49
Android Developers
Переглядів 129 тис.
Why use Type and not Interface in TypeScript
14:12
ByteGrad
Переглядів 184 тис.
You might not need useEffect() ...
21:45
Academind
Переглядів 126 тис.
Functions in Python are easy 📞
10:38
Bro Code
Переглядів 353 тис.
LiveData deprecated? - Full Guide to StateFlow
17:03
Philipp Lackner
Переглядів 52 тис.
Kotlin Flows in a Nutshell
13:59
Philipp Lackner
Переглядів 57 тис.
Learn JSON in 10 Minutes
12:00
Web Dev Simplified
Переглядів 3 млн