if, switch done

This commit is contained in:
2015-11-06 12:52:14 +01:00
parent f8e09400a2
commit 5b8ff9b59c
2 changed files with 113 additions and 4 deletions

20
programming/code/ifelse.m Normal file
View File

@@ -0,0 +1,20 @@
x = rand(1); % eine einzelne Zufallszahl
if x < 0.5
disp('x is less than 0.5');
end
if x < 0.5
disp('x is less than 0.5!');
else
disp('x is greater than or equal to 0.5!')
end
if x < 0.5
disp('x is less than 0.5!');
elseif x < 0.75
disp('x is greater than 0.5 but less than 0.75!');
else
disp('x is greater than or equal to 0.75!')
end