Skip to content
Snippets Groups Projects
Commit 010e48ec authored by vand's avatar vand
Browse files

Upload New File

parent 0d6f7797
No related branches found
No related tags found
No related merge requests found
%% module 3, example - short-circuit operators
name = 'Vedrana';
%name = '';
% I want to check if the name starts with 'Ved'. But what if name has less than
% 3 letters? I need to make sure that name[:3] is not evaluated if name is too
% short. I add the first condition and &&. The second condition will not be
% evaluated if the first is false.
if numel(name)>3 && all(name(1:3)=='Ved')
disp('Cool')
else
disp('Not so cool')
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment