E07400: returning variable and type missing
What went wrong
A function or method that should return a value doesn't have a return declaration.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 1319 (Why does EK9 reject an operator that takes a parameter...)
How to fix it
- Add return declaration
- Or ensure calling code doesn't expect return if void
Common causes
- Forgot to add return variable
- Copy from void function
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E07400: returning variable and type missing
#!ek9 defines module error.e07400.bad defines class Counter count <- 0 //'!' produces a value, so it must declare what it returns default operator ? operator ! as pure total <- count require total?
Fixed: Declare the returning variable
#!ek9 defines module error.e07400.good defines class Counter count <- 0 default operator ? operator ! as pure <- rtn as Integer: count
Questions and answers
These Q&A entries show E07400 and its fix: