Example
Create a script file and type the following code in it:
a = 100;
b = 200;
% check the boolean condition
if( a == 100 )
% if condition is true then check the following
if( b == 200 )
% if condition is true then print the following
fprintf('Value of a is 100 and b is 200\n' );
end
end
fprintf('Exact value of a is : %d\n', a );
fprintf('Exact value of b is : %d\n', b );
When you run the file, it displays:
Value of a is 100 and b is 200
Exact value of a is : 100
Exact value of b is : 200
No comments:
Post a Comment