Jump to content

Optional Function Parameters


UA

Recommended Posts

It really doesn't make much sense to do...

Code:
message_dialog("Something","");
A more sensible approach would be:
Code:
message_dialog("Something");
, where the second parameter is optional (can be treated as if it isn't there), but can be supplied if you want to use it.

 

This syntax is commonly signified using the following syntax:

Code:
void message_dialog(string string1[, string string2]);
Would be a good timesaving idea, and makes for cleaner code.
Link to comment
Share on other sites

Quote:
Originally written by Grey-Eyed Stranger:
Would be a good timesaving idea, and makes for cleaner code.
Timesaving? Three or four keystrokes (depending on whether you omit or use spaces between parameters). I don't know about you, but I don't make enough message_dialog calls (or any other calls with null parms, either) for that to add up to much. smile

As for cleaner code, I'd say it's a matter of opinion. It could be argued it leads to sloppier code, as well as confusion when newbs don't realize you CAN pass more than one parm to a particular call.

Regardless, this would be low on my own personal list of changes I'd like to see made to Avernumscript. For the amount of time it would take JV to implement, I'm not sure all of us combined would save enough of our own time to balance. laugh
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...