ENGR 121 Lecture Notes - Lecture 6: Matlab, Exclusive Or

36 views5 pages

Document Summary

Only one acion is executed because the condiion must be either true (acion 1) or false (acion2: if-else statements are not always necessary. Depending on what needs to be accomplished, it is correct to just have an. Nested if-else statements if statement without an else statement: to choose from more than two acions, use nested if-else statements if condiion1 acion1 else if condiion2 else acion2 acion3. The elseif clause: shortens the code and number of nested if-else statements needed if condiion1 acion1 elseif condiion2 else acion2 acion3, the elseif clause is not always necessary. Depending on what needs to be accomplished, it is correct to just have an else statement instead of an else-if statement. The switch statement: can frequently be used in place of a nested if statement switch switch_expression case caseexp1 acion1 case caseexp2 acion2 otherwise acion3. % prints either sin, cos, or tan of x. The is funcions: many is funcions that ask a true/false quesion.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents