Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
Int
Unit
Void
Nothing
It allows the function to be called using infix notation
It specifies that the function should not have a return value
It specifies that the function should not have a receiver parameter
It prevents the use of non-local returns in the function body
It allows the function to be called with or without argument names
It allows the function to be called with a variable number of arguments
It allows the function to be called using prefix notation
It allows the function to be inlined at the call site to improve performance
fun sum(x: Int, y: Int, op: (Int, Int) -> Int): Int = op(x, y)
fun sum(x: Int, y: Int, op: Int, Int -> Int): Int = op(x, y)
fun sum(x: Int, y: Int, op: Int.(Int) -> Int): Int = x.op(y)
fun sum(x: Int, y: Int, op: (Int) -> Int): Int = op(x + y)
It allows the function to be called using tail recursion optimization
None
fun sum(vararg nums: Int): Int = nums.sum()
fun sum(nums: Array): Int = nums.sum()
fun sum(nums: List): Int = nums.sum()
fun sum(nums: Set): Int = nums.sum()
It allows the function to be used as an overloaded operator
{ x: Int, y: Int -> x + y } (1, 2)
fun(x: Int, y: Int): Int { return x + y }(1, 2)
fun(x: Int, y: Int) = x + y (1, 2)
{ x, y -> x + y }(1, 2)