ENG 6 Lecture Notes - Lecture 6: While Loop, Matlab, Arithmetic Progression
Document Summary
Programming concept: code block: collection of matlab instructions identified if. You wish to execute them only under certain circumstances. You wish to repeat them a certain number of times: use other key words to identify code blocks, use indentations to identify code blocks/make them readable. Key command words: if, switch, while, for, case, otherwise, else, elseif, identified with blue coloring, not actually part of the code block, just instructions on what to do with code block. Requires two things: logical expression, code block. If expression is true, code block is executed. Otherwise, execution is resumed at instruction following code block. If-elseif: compound conditionals: by introducing elseif and else, allow for more tests if test returns false. General template for if-elseif statements: if