Skip to main content
1 of 2

Is there any way to use head of Real and Integer altogether?

guys. I am a newbie who would like to get your help. Is there any way to use the head of Integer and Real together like below? The below is not right, I know that, it is just for showing my thought.

f[x_(Integer||Real)]:=x^2; 

The reason I ask this is because I need a function that receive an argument which is either integer or real.

Thank you for your help guys. :)