_hyperscript
_hyperscript copied to clipboard
Feature Request: Default values for parameters of events and functions
Easier to show rather explain:
on reset(count = #words.children.length)
def nextWord(value = '')
If the event property wasn't set, then allow an expression to be evaluated for the default value of that property. Similarly, if an argument wasn't passed in, allow an expression to be evaluated for the default value of that argument to a function. I'm suggesting the =
syntax, but other words may make sense as well (such as default
). Note that this may be complicated once multiple arguments are concerned, such as
def nextWord(value = '', value2, value3 = 5)
The default
command can be used here:
on reset(count)
default count to #words.children.length
Not shutting down the discussion, just pointing it out for anyone who might not be aware.