If Statements: This video will cover if, else if, and else statements. Please watch the previous videos on boolean expressions before watching this video. This directly relies on the concepts in those videos. An if statement is a piece of code that will only execute when a boolean expression evaluates to true. Syntax: if boolean_expression statements that execute if boolean_expression is true end Basic example for absolute value (flip x to be positive) Else statements: Want to execute a piece of code when the boolean expression in the if statement is false. One end per if statement. Syntax: if boolean_expression statements that execute if boolean_expression is true else statements that execute if boolean_expression is false end Else example: Flip negative to positive, add 10 otherwise Else if statements: Execute code if a boolean expression is true AND the previously checked boolean expressions are false Use this to have many parallel choices. Can have as many elseif statements as you want. Always come after a single if and are followed by 0 or 1 else statements. Note the indentation. One option if this doesn't naturally occur in MATLAB is to highlight the code, right click and choose Smart Indent (or hit Ctrl+I) Syntax: if boolean_expression1 statements that execute if boolean_expression1 is true elseif boolean_expression2 statements that execute if boolean_expression2 is true AND boolean_expression1 is false elseif boolean_expression3 statements that execute if boolean_expression3 is true AND boolean_expression1/2 are false else statements that execute if all of the other expressions are false end Elseif example 1: Flip negative to positive; if between 0 and 5 (inclusive), add 5; if between 10 and 20 (inclusive), multiply by 2 Elseif example 2: Flip negative to positive; if between 0 and 5 (inclusive), add 5; if between 10 and 20 (inclusive), multiply by 2, otherwise set to 0