Top
Back: 5.1.138 write
Forward: 5.2.1 break
FastBack: 5. Functions and system variables
FastForward: 6. Tricks and pitfalls
Up: 5. Functions and system variables
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

5.2 Control structures

A sequence of commands surrounded by curly brackets ({ and }) is a so called block. Blocks are used in SINGULAR in order to define procedures and to collect commands belonging to if, else, for and while statements and to the example part in libraries. Even if the sequence of statements consists of only a single command it has to be surrounded by curly brackets! Variables which are defined inside a block are not local to that block. Note that there is no ending semicolon at the end of the block.

Example:
 
if ( i>j )
{
  // This is the block
  int temp;
  temp=i;
  i=j;
  j=temp;
  kill temp;
}

Top Back: 5.1.138 write Forward: 5.2.1 break FastBack: 5. Functions and system variables FastForward: 6. Tricks and pitfalls Up: 5. Functions and system variables Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.