I'm not able to understand why the last condition is not getting satisfied