0

enter image description here There is a return path problem I don't know what is the error reason. Actually the program structure is simple and clear

juharr
  • 31,741
  • 4
  • 58
  • 93
  • 1
    This program may don't reach any `return` statement. Actually, it does but compiler doesn't know it. – Héctor Oct 30 '17 at 17:01
  • please post the actual code, and not a picture of it – d.moncada Oct 30 '17 at 17:02
  • 2
    *Note*: Please provide code as text and not an image. – Spencer Wieczorek Oct 30 '17 at 17:02
  • While that logically covers the only paths that can occur, the compiler isn't that smart. You need a return at the end or at least at the end of both the outer `if` and `else`. Also in the future post the code instead of an image and the exact error message. – juharr Oct 30 '17 at 17:03
  • It would be better if you'd post the code text instead of a print of it. That way, we could easily copy it and point the problem. – Gabriel Rainha Oct 30 '17 at 17:03

1 Answers1

1

You have a return statement only in case you have items to iterate over in each one of the loops.The compiler doesn't check if this block of code is necessarily executed thus the compile error.

Yosi Dahari
  • 6,794
  • 5
  • 24
  • 44