我试过了,但失败了。“范围”用于哪些情况?
var list = listOf(1,2,3,4,5)
它运作良好。但是下面的代码并没有像我想要的那样工作。为什么?
var list = listOf(1 .. 5)
可运行的程序是:https : //pl.kotl.in/c5256MZEC。
我已经阅读了很多文章,但仍有一些我难以理解的事情。我不明白的地方在哪里?我的问题在代码中。我希望我问对了。
fun main() {
/*
1- Is it argument or parameter in numbers{} block?
where is it sent to the argument? why do we send "4" if it is parameter?
Are all the functions I will write in (eg println) sent to the numbers function? But this HOF can
only take one parameter.
*/
numbers {
/*
2-How does this know that he will work 3 times?
According to the following 3 functions? Is there a for loop logic??
*/ …Run Code Online (Sandbox Code Playgroud)