Reputation: 23
I want to print
*****
*****
*****
*****
*****
by using a for loop in the console of unity by using Debug.Log() of monoDevelop. Here is my code:
for(int row=1;row<=5;row++)
{
for(int column=1; column<=5;column++)
{
Debug.Log("*");
}
}
But it shows the output in this way:
*
*
*
*
*
till 25 rows.
Upvotes: 2
Views: 8029
Reputation: 15941
Debug.Log()
is a new lineIf you want to log a line of anything you need to concatenate it into a string, then Log()
that string.
for(int row=1;row<=5;row++)
{
string str = "";
for(int column=1; column<=5;column++)
{
str += "*";
}
Debug.Log(str);
}
Upvotes: 9