Why we need return statement inside the following condition:
if(col>row){
System.out.println();
printPattern(N,row+1,1);
return;
}
As the code is working correctly even without the return statement.
Why is the return statement necessary?
@shivamd999 It is not necessary to use a return statement here but for the sake of Clear code Understanding, we have used it. So that you know that if this condition is satisfied then the function should not be further used.It may be not change anything here but removing return statement can cause problem in other questions.