Your code formatting makes it very difficult to understand your code. I have reformatted your code to make it easier to see how the logic nests.
doing on its own line? It does not appear to do anything.
Will these loop bounds ever result in the loop body executing?
Under which circumstances will this statement execute? Keep in mind, a return statement immediately halts a function and returns the specified value.
It is really helpful to learn how to articulate problems with code. “It doesn’t work” does not provide much information that people can use to help you. If you are asking someone to give you help, it is easiest for them to give help if you give them as much information as you can.
Also, learning how to articulate problems helps increase your understanding and it help you troubleshoot on your own. This is known as ‘rubber duck debugging’.