%% Skip to Next Loop Iteration
% Count the number of lines of code in the file magic.m. Skip blank lines and comments using a continue statement. continue skips the remaining instructions in the while loop and begins the next iteration.

fid = fopen('magic.m','r');
count = 0;
while ~feof(fid)
    line = fgetl(fid);
    if isempty(line) || strncmp(line,'%',1) || ~ischar(line)
        continue
    end
    count = count + 1;
end
count
fclose(fid);

% Copyright 2015 The MathWorks, Inc.