function output = aPrime2(m)
% output is 1 if m is a prime number, 0 otherwise.  m>1.

%Alternate solution using the keyword RETURN

for d= 2:m-1
    if ( mod(m,d)==0 ) % Found a divisor, so m not prime
        output= 0;
        return;  % Control of the program returns to the place that 
                 % called this function.
    end
end

output= 1;  % No divisor<m found
