当前位置:网站首页>Kotlin let方法
Kotlin let方法
2022-06-11 01:26:00 【ScottePerk】
let方法会将函数链的前一个传入lambda表达式,并且可以使用it关键字代码这个传入的值,例如下面的代码,it表示的就是last()的值,这里是3。返回值是lambda表达式的最后一行。还是非常简单清晰的。
fun main() {
var result=listOf(1,2,3).last().let {
println("let's start")
it*it
}
println(result)
}
输出:
let's start
9
边栏推荐
- Oracle tablespaces, users, and authorization to users
- Colab报错:ImportError: cannot import name ‘_check_savefig_extra_args‘ from ‘matplotlib.backend_bases‘
- Go develop web
- 贵金属白银和现货白银之间是什么关系
- 软测人都该知道的七大原则
- Koa2 learning notes
- Closing method of SQL injection
- 浅析直播间海量聊天消息的架构设计难点
- SQL | 返回顾客名称和相关订单号以及每个订单的总价
- 贵金属白银行情走势图缘何强势?
猜你喜欢

SAP smartforms text content manual wrap output

Analysis of the difficulties in the architecture design of massive chat messages in the live broadcast room

当逻辑删除遇上唯一索引,遇到的问题和解决方案?

【并行与分布式系统】Cache学习

The diligent is the laziest

Epoll 原理及应用 && ET模式与LT模式

Orcale driver

NFT Insider #61:Animoca Brands 在 340 项投资中持有 15 亿美元的加密资产

Using an old mobile phone to build a server and achieve intranet penetration does not require root (I have personally tested the simplest one many times)

SQL | 返回顾客名称和相关订单号以及每个订单的总价
随机推荐
ME11/ME12采购信息记录及条件记录创建及更新BAPI:ME_INFORECORD_MAINTAIN_MULTI
接口自动化核心知识点浓缩,为面试加分
C language principle explanation and code implementation of scalable / reduced thread pool
2022 safety officer-a certificate special operation certificate examination question bank and simulation examination
Secret
English subtitle video translated into Chinese subtitles
cannot import name ‘dtensor‘ from ‘tensorflow. compat. v2.experimental‘
koa2学习笔记
Learning C language from scratch day 040
3P5 Industrial Engineering Lecture 1-2: Method of Study
The most complete format description of clang format
Using an old mobile phone to build a server and achieve intranet penetration does not require root (I have personally tested the simplest one many times)
如何保障数仓数据质量?
Day code 300 lines learning notes day 22
QT database learning notes (II) QT operation SQLite database
SQL | 返回顾客名称和相关订单号以及每个订单的总价
421. maximum XOR value of two numbers in the array
【无标题】
JS Part 5
378. 有序矩阵中第 K 小的元素