Is there anyway to define a function conditionally? For example in psuedo code:
IF (condition 1) then function(x)=x^2 ELSE function (x) = x.
I tried defining the function within an if staement, and it didn't work. I also thought about using the if statement within the definition for the function, but then is it possible to use variables/call other functions from 'main'? i.e. in this case I would need to pass 'condition 1' from main to the if statement within 'function'...(or condition 1 uses variables from main).