Currying subtraction

Report a typo

Develop a function named subtract(), applying currying. The function should receive two integers and return their difference as an integer. Illustrate the function usage in Kotlin, dividing the function call into two stages, each with one argument.

For example, using the developed subtract() function, the computation of 10 minus 2 should be executed as follows:

val difference = subtract(10)(2) // returns 8

Sample Input 1:

5 2

Sample Output 1:

3
Write a program in Kotlin
//write your code here

Create a free account to access the full topic