  | ### 5.2.14 return `Syntax:` `return (` expression_list `);` `return ();` `Type:` any `Purpose:` returns the result(s) of a procedure and can only be used inside a procedure. Note that the brackets are required even if no return value is given. `Example:`
      proc p2
      {
        int i,j;
        for(i=1;i<=10;i++)
        {
          j=j+i;
        }
        return(j);
      }
      // can also return an expression list, i.e., more than one value
      proc tworeturn ()
      { return (1,2); }
      int i,j = tworeturn();
      // return type may even depend on the input
      proc type_return (int i)
      {
        if (i > 0) {return (i);}
        else {return (list(i));}
      }
      // then we need def type (or list) to collect value
      def t1 = type_return(1);
      def t2 = type_return(-1);
See Data types; proc.

User manual for Singular version 4-0-2, 2015, generated by texi2html.