当前位置:网站首页>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
- The most complete format description of clang format
- 421. maximum XOR value of two numbers in the array
- 889. 根据前序和后序遍历构造二叉树
- Md61 plan independent demand import Bapi [by daily dimension / dynamic template / dynamic field]
- 力扣刷题篇——哈希表
- 421. 数组中两个数的最大异或值
- 14:00面试,14:08就出来了 ,问的实在是太...
- Unity3d detects that the object is not within the range of the camera
猜你喜欢

2022 simulated 100 questions and answers for crane driver (limited to bridge crane) examination

Analysis of common ADB commands

During SSH configuration key login, you need to pay attention to whether the private key is set with a password

可扩/减容线程池C语言原理讲解及代码实现

软测人都该知道的七大原则

Redis learning notes (continuously updating)

Oracle collects statistics

Colab reported an error: importerror: cannot import name '_ check_ savefig_ extra_ args‘ from ‘matplotlib. backend_ bases‘

20n10-asemi medium and small power MOS transistor 20n10

Internet of things final assignment - sleep quality detection system (refined version)
随机推荐
Redis learning notes (continuously updating)
叶酸配体的金属有机骨架材料MOFs负载5-氟尿嘧啶,西达本胺,紫杉醇,阿霉素,柔红霉素,布洛芬,喜树碱,姜黄素,藤黄酸等小分子药物
cannot import name ‘dtensor‘ from ‘tensorflow. compat. v2.experimental‘
ABAP CDs realizes multi line field content splicing
Orcale driver
为什么有的程序员能力一般却能拿到好offer?
InfoQ geek media's 15th anniversary solicitation | in depth analysis of container runtime Technology
Ortele has obtained three rounds of financing nine months after its establishment, and hard discount stores have found new ways to grow?
SQL | 返回顾客名称和相关订单号以及每个订单的总价
The diligent is the laziest
Find - (sequential search)
10007. ISBN号码
金属有机框架MOF-Al(DIBA),MOF-Zr(DIBA),MOF-Fe(DIBA)包载姜黄素/羧苄西林/MTX甲氨蝶呤/紫杉醇PTX/阿霉素DOX/顺铂CDDP/CPT喜树碱等药物
当逻辑删除遇上唯一索引,遇到的问题和解决方案?
14:00面试,14:08就出来了 ,问的实在是太...
Enrichment of core knowledge points of interface automation to add points to the interview
npm ERR Fix the upstream dependency conflict, or retry
关于Set集合类你都知道什么?来自《卷Ⅰ》的灵魂提问
Secret
92. CompletableFuture 实战