Check out example codes for "declaring a function in matlab". It will help you in understanding the concepts better.
Code Example 1
function f = fact(n)
f = prod(1:n);
end
Code Example 2
function ave = average(x)
ave = sum(x(:))/numel(x);
end
Code Example 3
%%%% general syntax %%%%%%%%%%%%%
function [return parameters] = name_of_function(attributes)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
body_of_the_function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
Learn ReactJs, React Native from akashmittal.com