Comments in Octave Scripts
Comments in Octave Scripts
In this tutorial, you will learn how to use comments in Octave scripts. A comment is useful text included in a script so that human readers can understand the code. Comments are not executed and are ignored by Octave.
Single Line comment
Comments make the Octave script or program easy to understand.
In the Octave, a single line comment starts with either the percent (%) or the # symbol and continues to the end of the line.
For example, a single-line comment is entered at the command prompt in the Command Window.
Block Comments
In the Octave language, entire blocks of text can be commented by enclosing the code between the following markers:
- %{ and %}
- #{ and #}
Example
% Octave Single Line Comment # This is also single line comment disp('Octave Tutorials'); %{ This is an Octave block comment This text will not execute %} disp('www.TestingDocs.com'); #{ This is another Octave block comment This text will not execute #}
Octave Tutorials
GNU Octave Tutorials on this website can be found at:
For more information on Octave, visit the official website: