Let us have this kind of code:
Function<int,int> someFunc=(x)=>{
//SomeCalc
return y;
}
than I want to use my function that way:
int result;
if(someFunc(k)!=0)
{
result=someFunc(k);
}
The question is does the compiler caches the function result so it will be calculated only one time? Or it will be calculated two times? Tried to google the answer but with no luck.
And what about caching the closures?