E07490: function must return a value
What went wrong
A function is expected to return a value based on its usage, but no return declaration is provided.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 866 (Why must functions used with stream call return a value?)
How to fix it
- Add return declaration to function
Common causes
- Function signature missing return
- Void function used where return expected
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E07490: function must return a value
#!ek9 defines module error.e07490.bad defines function sayHello() stdout <- Stdout() stdout.println("hello") greetAll() stdout <- Stdout() //call passes on what each function returns, and sayHello returns nothing cat [sayHello] | call > stdout
Fixed: Call functions that return a value
#!ek9 defines module error.e07490.good defines function greeting() <- rtn as String: "hello" greetAll() stdout <- Stdout() cat [greeting] | call > stdout
Questions and answers
These Q&A entries show E07490 and its fix:
Found a problem?
If EK9 reported E07490 for a program you think is valid, or did not report it where it should have, use the compiler form with the smallest program that shows it. If this page is wrong or unclear, use the documentation form. Both are at github.com/ek9lang/ek9-issues.