Site icon TestingDocs.com

Comments in Octave Scripts

Overview

In this tutorial, we will learn how to use comments in Octave scripts. A comment is some useful text included in a script for human readers to understand the code. Comments are not executed and 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:

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:

https://www.testingdocs.com/octave-tutorial/

For more information on Octave, visit the official website:

https://www.gnu.org/software/octave/index

Exit mobile version