### re: A Beginner Program I'm Rather Proud Of VIEW POST

re: Well, I couldn't articulate what I was thinking well without code, so I decided to take the opportunity for a little practice and wrote up a quick ...

Cool! Thanks for thinking about it and I'm glad I instigated some practice.
The language barrier is pretty strong, but I do see a while loop, which makes sense. However, I don't see any recursive function calls. Though I'm not sure of the syntax for function definition in C#, so I may be missing something.
Or I may be mis-understanding recursion. According to what I've recently learned a program is working recursively when a function calls itself. Do I have that right?
A week or two ago I wrote a post on Dev about iterative vs recursive functions, which I had just learned and was excited about.
Based on my understanding as I laid it out in that post, and my (potentially incorrect) reading of your code, yours looks more like an iterative solution.
I'm digging into this because I'm particulary interested in your earlier comment that "it could be a good exercise to change it to working recursively for n number of rows/cols" because I don't understand what that would look like.
All of that being, it seems to me that an iterative solution makes sense here.

I think you're correct and my solution was iterative as well, to write the correct number of rows. My understanding is that a recursive method calls itself, as you said. Defining methods in C# is where I wrote "private static void PrintGridSquares(int squareCounter){} and calling a method looks like PrintGridSquares(value). I called the method originally in Main(), then it gets called by itself for the number of squares in the grid (squareCounter). I created a new line at each row end, to make it a square grid.

I hooe that helps clear it up a bit!

code of conduct - report abuse