Mathematica has at least a few ways to do it.
I assume you already looked in Help and found your answers. And I'm unsure what your Guass function is (what book what equation) (there must be many guass equations).
I do know in the old Mathematica book it could be hard to find the right section in Help (if one looked up Function one got a lesson on that keyword). However in the new Help there are tutorial related guides and suggested other readings: I assume you've already found your answer.
Value assignment:
{detjacobs, Invdetjacobs} = Gauss[aar_Integer, es_, x1value_, x2value_, x3value_, x4value_, y1value_, y2value_, y3value_, y4value_] := Block[ {i=1,j=1}, Do[ Do[ r = aar[[i]]; s = es[[j]],imax],jmax] ]
where the last expr evaluated is the return value (Return[value] can be used). I used Block because
n=fun[x_]:=x+1;
does not include any facility for "local variables" which you may be used to (it actually DOES but that's a lesson on Context[]).
Delayed assignment (value is evaluated each time variable as a value appears)
{detjacobs, Invdetjacobs} := Gauss ...
Now note aar_Integer - it says this function is ignored if Guass is called with something other than. There can be many Guass each matching certain variable types or even certain patterned expressions.