Removing "optional" at the end of StackScript UDF?
I wrote a StackScript and have noticed that there is an "optional" at the end of every StackScript UDF.
I tried putting example="" but that did not work.
Anyone has any idea on how I can remove the "optional" word?
Thanks for any suggestions!
6 Replies
The following will work:
Once default attribute is used, the "optional" at the end of UDF will appear.
-Chris
I found some Stackscripts with 'optional="false"' in the UDF arguments, but that doesn't seem to do anything?
I am also confounded by this. Default values and optional parameters are not mutually exclusive. How can we eliminate the optional designation?
Default values and mandatory are mutually exclusive; they're the exact opposite of each other in this case, because there is no default default. If you give a default, then it takes over when nothing is provided, thus making the field optional. If you don't give a default, then the StackScript doesn't know what to set the field to if nothing is provided, thus making the field mandatory. There's no point in setting a default if the field needs to be mandatory, because the default would never be used (assuming it were possible to set a default and still have the field be mandatory).