Doubt with a concept taught in the video

In the func generate_brackets() from the video what is the use of return statement at the end of the function, isn’t that redundant , because the function ends at the base case anyways.
So why are we putting an extra return at the end?

Hey @chaturvedia336
Yes putting or not putting that return wont afffect ur code ,but control will also reach end of function
Say n=1
we call bracket(out,n,0,0,0) which calls bracket(out,n,1,1,0) which calls bracket(out,n,2,1,1) ->base triggers we return back to 2nd call here it will now check the other if condn and then reaches end of function and will automatically return since return type is void,so its a good practice to have a return here as well (even if not present will automatically return because of void type)

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.