void and return
For starters I still don't undersatnd basically everything so sorry for being stupid
Do you always have to use return in non void methods since its the only way to get a value out of it? Why would I make non void method without a return?
10 Replies
Yes, you always have to use the
return
statement in a non-void method.
(there's one minor exception to this, although that's not worth mentioning here)thinker227#5176
REPL Result: Failure
Exception: CompilationErrorException
Compile: 395.174ms | Execution: 0.000ms | React with ❌ to remove this embed.
if the return type is not void, youre guaranteeing to the caller that the method will return something
so you have to
return
Sorry I dont know what a caller is
whatever calls your method
aka executes it
So method
what
You execute methods in other methods
oh
yeah
Ok thanks this was helpful