Spiral matrix printing doubt in lecture

why only we are putting if condition in last 2 cases why not in all

because while loop conditons make sure that already so hence no need to place conditions for 1st two loops but after first 2 loops value of startrow and endcol changes and we have to make sure that they meet those conditions and hence we write them

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

ok got it thanks we can use them in while loop also then

no no …its like first 2 can print the elements but last 2 should check if it has been covered by first 2 or not???

Yup
,… .