function answer = count3s(turkey) % This function is called count3s and it will 
% return to the user some variable named "answer".

counter = 0; % This is a variable that we are going to use to 
% count the number of times we find the number 3.
% We must "declare" our variables before
% we use them, or Matlab (and most other programming
% languages get very cranky.

m = size(turkey, 1);
n = size(turkey, 2);

for i = 1:m
   for j = 1:n
      if (turkey(i,j)==3)  % When you compare two things in Matlab using if,
         % the two things should be enclosed in parentheses 
         % and if you're asking "are they equal?", you should use ==, 
         % which means "is equal to". 
         counter = counter +1; % This increments counter if and only if the
         % entry is equal to 3.  If it's not, Matlab simply
         % ignores this step.
         
         % The semicolon tells Matlab not to print anything.
      end
   end
end

answer = counter; % Remember that 'answer' is the value that we are 
% returning when the user calls this function.  
% Once we have finished counting, we assign "answer" 
% the same value as counter, and we are finished.  
% We rule.

