Top
Back: write
Forward: apply
FastBack: Functions
FastForward: System variables
Up: Functions and system variables
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

5.2 Control structures

5.2.1 apply  
5.2.2 break  
5.2.3 breakpoint  
5.2.4 continue  
5.2.5 else  
5.2.6 export  
5.2.7 exportto  
5.2.8 for  
5.2.9 if  
5.2.10 importfrom  
5.2.11 keepring  
5.2.12 load  
5.2.13 quit  
5.2.14 return  
5.2.15 while  
5.2.16 ~ (break point)  

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 need not be an 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: write Forward: apply FastBack: Functions FastForward: System variables Up: Functions and system variables Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 4.4.0, 2024, generated by texi2html.