Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
It allows the function to be called using infix notation
It allows the function to be inlined at the call site to improve performance
It allows the function to be called with a variable number of arguments
It allows the function to be used as an overloaded operator
fun
function
define
declare
It allows the function to be called using tail recursion optimization
It allows the function to be called with or without argument names
A named function
A higher-order function
An anonymous function
A function with a single expression
fun noArgs()
fun noArgs(): Unit
fun noArgs(): Void
fun noArgs(): Nothing
It allows the function to be called using prefix notation
{ x: Int, y: Int -> x + y }
{ x: Int -> x * x }
{ x -> x * x }
fun(x: Int, y: Int): Int = x + y
It prevents the use of non-local returns in the function body
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)
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()