Method don't reaches it's end. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Method don't reaches it's end.

Can someone please explain this to me: why am I getting this message which says: method never reaches it's end or a ' return ' statement.

29th Nov 2020, 9:45 PM
Salah
Salah - avatar
6 Answers
+ 2
Your method is recursive with no ending base case(s) and is also missing a closing } here. It's an infinite loop and never exits the method.
29th Nov 2020, 10:15 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Could you give me an example?
29th Nov 2020, 9:52 PM
OverdrivedProgrammer
0
static void PrintToPoint (float [ ] p) { }
29th Nov 2020, 9:55 PM
Salah
Salah - avatar
0
When I move over the method name, I get the message: method never.. etc
29th Nov 2020, 9:56 PM
Salah
Salah - avatar
0
This is the full method: static void PrintToPoint ( float [ ] p ) { PrintToPoint ( new float [3] {p [0], p [1], p [2] } );
29th Nov 2020, 9:59 PM
Salah
Salah - avatar
0
Thanks for the explanation. I'm still learning my way to programming. Can you please show me where is the infinite loop? I mean, how can I tell if there is an infinite loop, like in my method? Thank you again.
30th Nov 2020, 12:03 AM
Salah
Salah - avatar