Command Sequence Controls
Indenting
Indenting
Note that the above code has indents under each of for and if statement
Indenting makes code more readable, as you can see the logical structure which becomes especially important when you have several for/if statements in one M-file. While working on this practical, make sure that you follow this formatting convention.
Exercise: Counter variable > Reconsider the above example without indenting. Which is easier to read?
|
Tip: There is an option called Smart Indent, which will indent highlighted code properly and automatically. See Indent>Smart Indent (the first icon) in the M-file Editor menu bar. |
Example: % determine the number of elements in allNumbers bigger count = 0; end |