E07520: must return a Boolean
What went wrong
A function or method is required to return Boolean but returns a different type.
Worked examples
Compilable examples demonstrating this error and the correct fix:
How to fix it
- Ensure return type is Boolean
Common causes
- Predicate function with wrong return
- Condition implementation error
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E07520: must return a Boolean
#!ek9 defines module error.e07520.bad defines class Reading celsius <- 0.0 //'?' answers yes or no override operator ? as pure <- rtn as Integer: 1
Fixed: Return a Boolean
#!ek9 defines module error.e07520.good defines class Reading celsius <- 0.0 override operator ? as pure <- rtn as Boolean: celsius?
Questions and answers
These Q&A entries show E07520 and its fix:
- Q5: How are EK9 source files structured?
- Q16: How does indentation work in EK9?
- Q22: How do I declare a variable in EK9?
- Q24: How do I convert between types?
- Q25: What is the promote operator?
- Q28: How do I declare multiple variables at once?
- Q89: How do I use streams and stream pipelines in EK9?
- Q122: How do I use collect as to aggregate stream results in EK9?
- Q131: What is the EK9 equivalent of Python list comprehensions?
- Q184: How do I find the first item matching a condition in EK9?
- Q237: When should I use a stream pipeline vs a loop in EK9?
- Q238: What operators does EK9 support and why is the set fixed?
- Q239: How do comparison and ordering operators work in EK9?
- Q245: How do I implement all the operators my custom type needs?
- Q596: What is the difference between a function and a method in EK9?
- Q779: Why must certain operators return a value in EK9?
- Q1142: Sum the prices of all products over 20 using a stream pipeline.