E07470: function must have a two parameters
What went wrong
A function or operator requires EXACTLY two parameters but has a different number.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 124 (How do I group and aggregate collection data in EK9?)
[BINARY OPERATORS (require two parameters)] +, -, *, /, ==, <, >, <=, >=, <>, <=>
How to fix it
- Provide exactly two parameters
Common causes
- Missing parameter
- Extra parameters
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E07470: function must have a two parameters
#!ek9 defines module error.e07470.bad defines function byLength() -> word as String <- rtn as Integer: length word sortWords() <- rtn as List of String: List() //sort compares two items at a time cat ["three", "one", "seven"] | sort byLength > rtn
Fixed: Give sort a function of two parameters
#!ek9 defines module error.e07470.good defines function byLength() -> first as String second as String <- rtn as Integer: length first <=> length second sortWords() <- rtn as List of String: List() cat ["three", "one", "seven"] | sort byLength > rtn
Questions and answers
These Q&A entries show E07470 and its fix: