JET-121 Extension closure scope, empty?
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
namespace jet121 {
|
||||
fun box() : String {
|
||||
val answer = apply("OK") { String.() : Int =>
|
||||
length
|
||||
get(0)
|
||||
}
|
||||
|
||||
return if (answer == 2) "OK" else "FAIL"
|
||||
}
|
||||
|
||||
fun apply(arg:String, f : {String.() : Int}) : Int {
|
||||
return arg.f()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user