HIGHER-ORDER FUNCTIONS with two parameters 1

HIGHER-ORDER FUNCTIONS with two parameters

higher-order functions

Here is what the above code is Doing:
1. We’re defining a function called “apply_to_one” that takes in a function and a number.
2. We’re defining a function called “add_one” that takes in a number and returns that number plus one.
3. We’re defining a function called “subtract_one” that takes in a number and returns that number minus one.
4. We’re calling the “apply_to_one” function with the “add_one” function and the number 1.
5. We’re calling the “apply_to_one” function with the “subtract_one” function and the number 1.

Similar Posts