Post a reply
Username:
Note:If not registered, provide any username. For more comfort, register here.
Subject:
Message body:
Enter your message here, it may contain no more than 60000 characters. 

Smilies
:D :) :( :o :shock: :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:
Font size:
Font colour
Options:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation of post
To prevent automated posts the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.
Confirmation code:
Enter the code exactly as it appears. All letters are case insensitive, there is no zero.
   

Topic review - Procedure with optional parameters
Author Message
  Post subject:  Re: Procedure with optional parameters  Reply with quote
https://www.singular.uni-kl.de/Manual/4-2-0/sing_44.htm
Post Posted: Sun Apr 04, 2021 4:35 pm
  Post subject:  Procedure with optional parameters  Reply with quote
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.
Post Posted: Sat Apr 03, 2021 6:27 pm


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