64
MATLAB if-else… end statement
If the first condition is not true, then we can define other statements to run by using the else keyword.
Syntax:
Flow Diagram of if…else…end Statement
Example1:
Output:
a = 15 an odd number
Example2:
Using if-else statement to determine the largest of two number
Output:
Enter number 1: 15 Enter number 2:20 num1 is less than num2
Next TopicMATLAB if-elseif-else…end statement