Top
Back: 6.2.4 Usage of commas
Forward: 6.2.6 Behavior of continue
FastBack: 6. Tricks and pitfalls
FastForward: A. Examples
Up: 6.2 Major differences to the C programming language
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

6.2.5 Usage of brackets

In SINGULAR, curly brackets ({ }) must always be used to enclose the statement body following such constructs like if, else, for, or while, even if this block consists of only a single statement. Similarly, in the return statement of a procedure, parentheses (( )) must always be used to enclose the return value. Even if there is no value to return, parentheses have to be used after a return statement (i.e., return();). For example,

 
if (i == 1) return i;    // WRONG!!!!!

results in an error. Instead, it must be written as

 
if (i == 1) { return (i); }

Top Back: 6.2.4 Usage of commas Forward: 6.2.6 Behavior of continue FastBack: 6. Tricks and pitfalls FastForward: A. Examples Up: 6.2 Major differences to the C programming language 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.