Hi there. I got a problem with some of my code, but I just can't see what the problem is. Can you help me out on this one?
LasIn.lasHeltal() reads int-inputs from the console, there's no problem with that one atleast.
Now this is what I get when the compiler gets to this part:
Any help appreciated :roll: (I'm from Sweden) [ May 21, 2005: Message edited by: Nicholas Censored ]
Joined: Jan 14, 2005
gomorron Nicke! hur �r v�dret dit p� r�tta sidan av Atlanten?
i think i see your problem - the only return statements in your method are wrapped up in an if-else block, and the compiler isn't smart enough to understand that either the "if" or the "else" will necessarily be executed. it thinks there might be some way for control to pass by the whole "if" statement entirely, in which case it would fall off the end of the method without ever "return"ing anything.
the easy way to fix this is to put in a bogus, unreachable return statement after the end of the "else" block, just before the closing brace of the method. this should make the compiler happy.
on edit: there is also a hard way to fix your problem, which would involve thinking about the structure of your code. look at the "while" loop, specifically, and ponder whether or not it is really needed. how many times will it run, and why? [ May 21, 2005: Message edited by: M Beck ]
Joined: Feb 08, 2004
imagine that boolean stop allways evaluates true; in that case the loop never executes, and so never outputs a return statement...
so,after your while end bracket write:
hope this helps
Joined: May 21, 2005
V�dret �r mulet liksom �lgens n�sa (mulen).
I solved my problem by rewriting the calling code and then removed the while-loop.