kotlin - 如何从嵌套 lambda 引用单个参数(它)的上层 lambda 隐式名称?
问题描述
例如,我有一段代码:
testie.testy?.let { // reference to this it
testContext.update {
it.testiest = it //How can I there reference to upper-level it?
}
}
如何在块中引用 from it.tesiest
to ?it
let
对于现在的解决方法,我在上面的 lambda 中使用命名参数。但我认为在不引入命名变量的情况下,还有其他方法可以在正确的位置进行引用。
解决方案
推荐阅读
- html - 防止父母从孩子成长
- python-3.x - 每个 csv 作为一个训练样例
- css - 如何在antd(白色主题)中实现带有logo和菜单的固定标题?
- c# - 混淆单个 And & 运算符以及如何将其记录在数据库中
- c - 如何摆脱C中的嵌套循环?
- javascript - 将点表示法与功能组件一起使用
- bit-manipulation - 4<<1<<2 怎么是 32?
- python - 在使用 reticulate 创建的 virtualenv 中安装特定版本的 python 包
- python - 使用beautifulsoup从网站的搜索结果中获取列表并隐藏到数据框
- ios - ApplePay 问题 - 付款未完成