Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Procedure with optional parameters
PostPosted: Sat Apr 03, 2021 6:27 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject: Re: Procedure with optional parameters
PostPosted: Sun Apr 04, 2021 4:35 pm 

Joined: Wed May 25, 2005 4:16 pm
Posts: 275
https://www.singular.uni-kl.de/Manual/4-2-0/sing_44.htm


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

It is currently Fri May 13, 2022 10:54 am
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group