function F = fact(n)
%Input: Some integer
%Output: The factorial of the input

%You need to set an initial value first, which must be 1
F = 1;
for i = n:-1:1  %You can have n count forward or backwards
                %I use backwards because that is how we compute it normally
    F = F*i;    %Multiply F by itself and i (your current value)
end
%Why did F have to be 1 at first?  Try passing 0 into the function.
