Octave style guide: Difference between revisions

Jump to navigation Jump to search
m
Line 23: Line 23:


=== Whitespace ===
=== Whitespace ===
===== Function Calls =====


When calling functions, put spaces after commas and before the calling
When calling functions, put spaces after commas and before the calling
Line 38: Line 40:
Here, putting spaces after {{codeline|sin}}, {{codeline|cos}} would result in a
Here, putting spaces after {{codeline|sin}}, {{codeline|cos}} would result in a
parse error.
parse error.
===== Indexing Expressions =====


For indexing expressions, do ''not'' put a space after the
For indexing expressions, do ''not'' put a space after the
Line 49: Line 53:


<pre>A([1:i-1;i+1:n], XI(:,2:n-1))</pre>
<pre>A([1:i-1;i+1:n], XI(:,2:n-1))</pre>
===== Matrix Definition =====


When constructing matrices, prefer using the comma rather than the space to
When constructing matrices, prefer using the comma rather than the space to
Line 65: Line 71:
             44.04 55.05  6.06];
             44.04 55.05  6.06];
</pre>
</pre>
===== Arithmetic Operators =====


Do include spaces around all binary arithmetic operators, for example
Do include spaces around all binary arithmetic operators, for example
1,072

edits

Navigation menu