![]() ![]() ![]() The way they refer to the context object. There are two main differences between each scope function: Distinctionsīecause scope functions are similar in nature, it's important to understand the differences between them. We also recommend that you avoid nesting scope functions and be careful when chaining them because it's easy to get confused about the current context object and value of this or it. The use cases of different scope functions overlap, so you can choose which functions to use based on the specific conventions used in your project or team.Īlthough scope functions can make your code more concise, avoid overusing them: it can make your code hard to read and lead to errors. Grouping function calls on an object: with Running statements where an expression is required: non-extension run Object configuration and computing the result: run Introducing an expression as a variable in local scope: let Here is a short guide for choosing scope functions depending on the intended purpose:Įxecuting a lambda on non-null objects: let No: takes the context object as an argument.ĭetailed information about these functions is provided in the dedicated sections below. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |