We are about to switch to a new forum software. Until then we have removed the registration on this forum.
If I want to do something like this:
boolean test () {
if (something) {
return true;
}
}
There is an error saying:
This method must return a type boolean.
How do I fix it?
Answers
https://forum.Processing.org/two/discussion/15473/readme-how-to-format-code-and-text
If we declare that some method is expected to
return
aboolean
, it must do so no matter what! L-)Pay attention there: The only
return
statement is conditioned to something.What should it
return
instead in case something is evaluated asfalse
? :-?Oh... I get it now! Thanks!
Fix template attempt: ;;)
There are other ways to do it, of course. $-)
@GoToLoop I suppose you refer to this (stick to Java 7) -