Whitespace in statements
ID | LAYOUT-3 |
Title | Surround operators with spaces. |
Priority | Recommended |
Severity level | 9 |
Description | Surround the following operators with spaces:= : ^ == <= >= < > ~= & && | || + - * .* / Do not add a space between the unary minus-sign and its operand. |
Rationale | Whitespace around operators often leads to improved readability. As an exception, do not use spaces around the equals signs when using the Name=Value syntax introduced in MATLAB R2021a. |
Avoid:
isValid=y>0&&x==-1;
Instead use:
isValid = y > 0 && x == -1;