GNU Octave Manual Version 3 by John W. Eaton, David Bateman, Søren Hauberg Paperback (6"x9"), 568 pages ISBN 095461206X RRP £24.95 ($39.95) |
10 Statements
Statements may be a simple constant expression or a complicated list of nested loops and conditional statements.
Control statements such as if
, while
, and so on
control the flow of execution in Octave programs. All the control
statements start with special keywords such as if
and
while
, to distinguish them from simple expressions.
Many control statements contain other statements; for example, the
if
statement contains another statement which may or may not be
executed.
Each control statement has a corresponding end statement that
marks the end of the control statement. For example, the
keyword endif
marks the end of an if
statement, and
endwhile
marks the end of a while
statement. You can use
the keyword end
anywhere a more specific end keyword is expected,
but using the more specific keywords is preferred because if you use
them, Octave is able to provide better diagnostics for mismatched or
missing end tokens.
The list of statements contained between keywords like if
or
while
and the corresponding end statement is called the
body of a control statement.
ISBN 095461206X | GNU Octave Manual Version 3 | See the print edition |