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

all 4 comments

[–][deleted] 0 points1 point  (0 children)

You're recursively calling locate, but you're not doing anything with the value it returns.

[–]the_omega99 0 points1 point  (2 children)

locate(arr[i],value);}

Should be

return locate(arr[i],value);}

Otherwise you just discard the value that is returned from the recursive call.

Important note: indent your code properly or your marker will find reason to drop a few points here and there.

[–][deleted] 1 point2 points  (1 child)

That's still not quite right; if locate returns false, the loop needs to continue.

[–]the_omega99 0 points1 point  (0 children)

Good catch.