EdgeQL Tutorial

User-Defined Functions

Subtopics

Sometimes you need a function that takes an arbitrary number of arguments. These are the so-called variadic functions or, more precisely, functions with variadic arguments. Only one argument can be designated as variadic. Within the function body the variadic argument becomes an array. Let's write a function that takes some arguments and adds all the even ones while subtracting all the odd ones:

Input
Run
Output
Press the 'Run' button to evaluate the input

And now we can try it out:

Input
Run
Output
Press the 'Run' button to evaluate the input