Return@ From within function parameters / callback
If I have something like:
fun create( param1 : Int, param 2: (Int, String) -> Unit = {
, -> } ) : SomeDataClass {
return SomeDataClass(params...).apply { init() }
}
fun myError(String) -> Unit //prints the error
fun caller() {
//... outervariable : String?
val x : SomeDataClass = create(1, { innerparam1, innerparam2 ->
if(outervariable == null) return@create myError("My error")
//do something, without return keyword
})
}
There are a lot of things that are...