I want to know how to define functions. I dont mean a function in the sense f[x_]:=x^2 for example, but I mean a function which takes parameters and returns something. Like in C++, you can define such a function as
int function(int parameter){
//do something
return something;
}
and then in the main function we can call this function. How can we do something like this in Mathematica? If I look for function on google, all I get is the function in the sense f[x_]:=x^2.
Edit:
I want to do the following for example. I want the input and output to be polynomials in some variables, and the function is a differential operator. For example, $p(x_1,...,x_n)=x_1^2+...+x_n^2$ and the differential operator is for example $\sum_{i=1}^nx_{n+1-i}\partial x_i$ where $\partial x_i$ takes the derivative of the polynomial with respect to $x_i$.
f[x_] := x^2
takes one parameter and returns one result. In this respect it behaves just like the C function you showed. I don't understand your question. Perhaps read through this: reference.wolfram.com/language/tutorial/… $\endgroup$