3. Control flow and functions
Control execution order and reuse logic with functions, imports and fragments. -> defines a script function, import loads a resource, and @@ calls a registered language executor.
- Control flow: execution, branches, assertions, return and exit.
- Functions: parameters, anonymous functions, outer variables and recursion.
- Imports and reuse: libraries and other DataQL scripts.
- Code fragments: executor names, parameters and batch calls.
var shipping = (amount) -> {
if (amount >= 100) {
return 0;
}
return 10;
};
return shipping(80);
The result is 10. Use result transformation or collection functions to process list items.