function idx=testIt(v)
%testIt  a test function to play with ideas
%
% takes a vector v and returns an index
%
% the definition is constantly changing as we
% try out different ideas
%
% P. Conrad for CISC106 10/11/06

firstValue = v(1);

for k = 2:length(v)

  % if this element of v is different
  % then the previous element was the one
  % whose index we need to return

  if ( v(k) ~= firstValue)
    idx = k - 1;
    return;   
  end;
end;

% postcondition:  If I got all the way thru
%  the loop, and did not return yet, it means
%  that the statement v(k) ~= firstvalue was
%  FALSE for EVERY value of k.
% Therefore I can conclude:

idx = 0;
end
