Piecewise defined function in tikz or tkz-fct
I wish to write a macro that gets a number x. If x is smaller than 1, it should return x, otherwise, it returns x^2. I need it for a piece-wise function for TikZ, but I want it as a macro as I will be running it several times. Any easy way to do it?