# C# beginner, need some help

HI,

Ive just started learning c# , have been following an online tutorial and have just purchased a book.

I am learning about loops and have been trying to get my head around them, I have included a couple of examples with my notes of what I think is happening, would someone mind taking a look and telling me if I am thinking correctly.

Example 2 I have an issue with which i have marked.

EDIT – Reddit doesnt seem to like the patterns of asterisks, so I will put a link to the actual website where I am getting these from – http://ift.tt/1xKoryQ – the section near the bottom "Nesting Loops and Some Practice" (of course I'm sure you know what it is supposed to print out anyway!)

## Example 1

Want to create this :

The code to do this is this:

1 – for(int row = 0; row < 5; row++) 2 – { 3 – for(int column = 0; column < 10; column++) 4 – { 5 – Console.Write("*"); 6 – } 7 –
8 – Console.WriteLine(); // This makes it wrap back round
9 –
10- }

My understanding :

Start at Line 1 – Row becomes 1, move to line 3 Column increments from 0 to 9 and prints a ‘*’ for each time column is less then 10. When column is no longer less than 10 it moves to line 8 and writes a new line. Then it goes back to line 1. This loops until row = 5 then finishes.

## Example 2

If we want to do this:

* **

the code would be:

1 – for(int row = 0; row < 10; row++) 2 – { 3 – for(int column = 0; column < row + 1; column++) 4 – { 5 – Console.Write("*"); 6 – } 7 –
8 – Console.WriteLine(); 9 – }

My understanding :

Start at line 1, Row becomes 1 Moves to line 3 Column becomes 1, prints a ‘’ <stuck at this bit> – Column is still 1, and therefore still less then (row+1) so should print another ‘’ before it moves to line 8 and writes a new line.

where am I going wrong here?

thanks.

by huntinwabbits via /r/csharp