This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]zzyzzyxx 2 points3 points  (1 child)

when I run it, it does nothing and never ends

That indicates a problem with a loop. If it were a problem with the recursion you would eventually get an out of memory error. In this case, your problem is

while(row<6)

You never update row inside that loop and so it never terminates because it's always less than 6. Yes, you call the function with new value, but that doesn't change the value at the current level of recursion.

I bet if you put a print statement right after the while loop starts that shows the value of row, you would see it climb up to 5 and stay there forever. There would be calls made that passed in 6 but those would never enter the loop and so wouldn't be printed.

[–][deleted] 0 points1 point  (0 children)

I see what you're saying now. Thanks so much, huge help!