Singular
https://www.singular.uni-kl.de/forum/

Procedure with optional parameters
https://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=2943
Page 1 of 1

Author:  Guest [ Sat Apr 03, 2021 6:27 pm ]
Post subject:  Procedure with optional parameters

Hey everyone!

I'm trying to write a procedure that has optional parameters which are set to fixed values if no value is given, i.e. something like

Code:
proc Test (int n, int m = 10) {
return(n*m);
}

Test(2);
//-> 20

Test(2,5);
//-> 10


However, I couldn't find any straight forward way to do this inside of the documentation. Is there any possibility to do this?

Thanks in advance.

Author:  hannes [ Sun Apr 04, 2021 4:35 pm ]
Post subject:  Re: Procedure with optional parameters

https://www.singular.uni-kl.de/Manual/4-2-0/sing_44.htm

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/