Jump to navigation Jump to search
562 bytes added ,  12:00, 12 March 2018
→‎Whitespace: add style for arithmetic expressions
parentheses, like this:
<pre>x = max (sin (y+3), 2);</pre>
An exception are matrix or cell constructors:
prices = [ 1.01 2.02 3.03
44.04 55.05 6.06];
Do include spaces around all binary arithmetic operators, for example
x = 1 / (1 + y) ^ 2;
An exception is for extremely simple expressions like <pre>n+1</pre>, in
particular when used as an argument to a function or as part of an indexing
expression. For example, you may write
Another exception is for complex arithmetic expressions. It may improve
readability to omit spaces around higher precedence operators, for example
z = cat (dim, (x2.*y3 - x3.*y2), (x3.*y1 - x1.*y3), (x1.*y2 - x2.*y1));


Navigation menu