What are some ways of passing the return value of one function as an argument to another?
What are some examples in programming languages that you favor, JS, Python, etc?
What are some ways of passing the return value of one function as an argument to another?
What are some examples in programming languages that you favor, JS, Python, etc?
var x = AnotherFunction(ReturnFunction(someVariable));
where AnotherFunction()
accepts the same type that ReturnFunction()
returns.
Most modern languages allow this.
do you mean like the following C code:
int foo(void) {
return 4; /* XKCD standard random number */
}
int bar(void) {
do_something(2,foo());
return 0;
}
That has nothing to do with functional programming [read up at http://en.wikipedia.org/wiki/Functional%5Fprogramming ]
In F# you can pipe it like so
f() |> g
(assuming f
returns a T
and g
takes a T
)