-
Notifications
You must be signed in to change notification settings - Fork 0
/
conditional_statement.m
60 lines (46 loc) · 1.39 KB
/
conditional_statement.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
%--------------------------------------------------------------
% Welcome to Getscriptall
%--------------------------------------------------------------
% Conditional statements:
%--------------------------------------------------------------
% If statement:
%--------------------------------------------------------------
a=1;
if (a==1)
disp(' true');
end
%--------------------------------------------------------------
% Else if ladder
%--------------------------------------------------------------
a=2;
if(a==1)
disp(' true 1');
elseif(a==2)
disp('true 2');
else
disp('true 3');
end
%--------------------------------------------------------------
% Nested if
%--------------------------------------------------------------
a=2;
if (a==2)
if (a==2)
disp(' true Nested');
end
end
%--------------------------------------------------------------
% Switch statement
%--------------------------------------------------------------
s=2;
switch(s)
case 1
disp(' true 1');
case 2
disp(' true 2');
otherwise
disp('Error');
end
%----------------------------------------------------
%%%%%%%%%%%-------------------$$$$$$$$>>>>> BY Getscriptall <<<<$$$$$$$$$-----------------%%%%%%%%%%%%%%
% @@@ for any query contact: info.getscriptall@gmail.com