I'm not exactly sure what youa re asking, but to declare a function in FreeMat is very much like your first example -
function return_value = fun_name(arg1,arg2)
return_value = arg1 + arg2;
end
If you don't wish to specify a return value (which is returned as ans to the FreeMat terminal upon execution of the function), you can simply say
function fun_name(arg1,arg2)
arg1+arg2 % note output is not suppressed
end
If you have a function and you want to define a second funciton in the same code, you can do this:
function return_value = fun_name(arg1,arg2)
return_value=subfun(arg1,arg2);
end
function subreturn = subfun(arg1,arg2)
subreturn = arg1+arg2;
end
and the effect will be the same. Hope this helps!
TJ