E01082: multiple '->' arrows not supported - use indented block for multiple parameters
What went wrong
EK9 uses ONE '->' arrow followed by an indented block for multiple parameters. You cannot use multiple '->' arrows - each one would start a new parameter block.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 916 (How do I declare multiple parameters on a function in ...)
How to fix it
- Remove additional '->' arrows
- Indent parameters as a block under a single '->'
- Each parameter on its own line with proper indentation
A single parameter may stay on the arrow's line ('-> name as String'). The [EXAMPLE] section below shows the repeated arrows rejected and the one-arrow block that replaces them.
Design rationale
EK9's parameter syntax mirrors its return syntax:
- ONE '->' introduces incoming parameters
- ONE '<-' introduces the return declaration
- Multiple parameters use indentation, not repeated arrows
This creates visual consistency and prevents the arrow-soup common in languages that use arrows liberally.
See also
- E01083: Multiple '<-' arrows (return declarations)
- https://ek9.io/functions.html
- https://ek9.io/methods.html
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E01082: multiple '->' arrows not supported - use indented block for multiple parameters
#!ek9 defines module error.e01082.bad defines class ExampleClass //Method with multiple arrows - incorrect badMethod() -> text as String -> count as Integer <- rtn as Boolean: true //Correct method goodMethod() -> text as String count as Integer <- rtn as Boolean: true defines function //Two parameters with separate arrows - incorrect badTwoParams() -> param1 as String -> param2 as Integer <- result as String: param1 //Three parameters with separate arrows - incorrect badThreeParams() -> param1 as String -> param2 as Integer -> param3 as Float <- result as String: param1 //Correct way - single arrow with indented block goodMultipleParams() -> param1 as String param2 as Integer param3 as Float <- result as String: param1
Fixed: One '->' with the parameters in an indented block
#!ek9 defines module error.e01082.good defines class ExampleClass hasLength() -> text as String count as Integer <- rtn as Boolean: length text == count defines function describe() -> label as String count as Integer <- result as String: `${label} x ${count}`
Questions and answers
These Q&A entries show E01082 and its fix: