Top
Back: Behavior of continue
Forward: First index is 1
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.7 Return type of procedures

Although the SINGULAR language is a strongly typed programming language, the type of the return value of a procedure does not need to be specified. As a consequence, the return type of a procedure may vary, i.e., may, for example, depend on the input. However, the return value of such a procedure may then only be assigned to a variable of type def.

 

Furthermore, it is mandatory to assign the return value of a procedure to a variable of type def, if a procedure changes the current ring using the keepring command (see keepring) and returns a ring-dependent value (like a polynomial or module).

 

On the other hand, more than one value can be returned by a single return statement. For example,

 
proc tworeturn () { return (1,2); }
int i,j = tworeturn();


Top Back: Behavior of continue Forward: First index is 1 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 3-1-6, Dec 2012, generated by texi2html.