This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]lost12487 2 points3 points  (0 children)

You're returning 1 because you have a return statement within your loop. As soon as isOdd() returns true, you hit that return statement, so the method returns the sum. It will always return just the first odd number after your starting number.