please give me a dry run of the else block i m not understandable with the else block…
Else block not understandable
if block is returning false if the previous element is greater than the next element
and the else block is making call and return the result which it receives.
suppose we have an array 1 3 4
so 1 < 3 if will not be executed
else make call for next index
now 3<4
so here also if will not be executed
else make a call for the next index
now 4 is last element
here index = last index of array, returns true from the base condition
hence the else block will return true
suppose if the array is like 1 5 2
the 1 < 5
else will make call for the next element
now 5> 2
so here if block will return false
hence the else block which has made the call for the next element will receive false and it will return the false
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.