www.delorie.com/gnu/docs/octave/octave_78.html   search  
 
Buy GNU books!


GNU Octave

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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 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.

10.1 The if Statement  
10.2 The switch Statement  
10.3 The while Statement  
10.4 The for Statement  
10.5 The break Statement  
10.6 The continue Statement  
10.7 The unwind_protect Statement  
10.8 The try Statement  
10.9 Continuation Lines  


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003