Alex
10/02/2021, 5:46 PMinline fun <T, R> T.let(*block*: (T) -> R): R
1) <T, R> T what does the extra T outside the <> mean
2) What does R mean
Kirill Grouchnikov
10/02/2021, 5:55 PMJoffrey
10/02/2021, 5:56 PM<T,R>
and the following T
are 2 separate parts of the function definition.
• The part between <> declares the type parameters of the function (because the function is generic).
• The following T
is the receiver of the function, because let
is an _extension_ function.
• The R
is a generic type used as the return type of the function and also as the return type of the block
argument (which is also a function)Alex
10/02/2021, 6:11 PM