Top
Back: Usage of commas
Forward: Behavior of continue
FastBack: System dependent limitations
FastForward: Miscellaneous oddities
Up: Major differences to the C programming language
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

6.3.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: Usage of commas Forward: Behavior of continue FastBack: System dependent limitations FastForward: Miscellaneous oddities Up: Major differences to the C programming language Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 4-0-3, 2016, generated by texi2html.