Page 1 of 1

Function : Default parameters

Posted: Sun Apr 01, 2018 1:24 pm
by djrikki
It would be helpful in some projects if we were able to specify default parameters on a Function statement something akin to ES6/ES2015 in JavaScript.

Code: Select all

/* example */
Function Say(word = "Hello World!")
   DebugPrint(word)
EndFunction

Say("Hello Andreas!")
Say()
Output:

Code: Select all

Hello Andreas!
Hello World!

Re: Function : Default parameters

Posted: Mon Apr 02, 2018 9:46 pm
by airsoftsoftwair
Unlikely to happen because it'd require extensive work on the VM. There are ways to do it, however. See here: https://stackoverflow.com/questions/602 ... -arguments