can someone please tell me what im doing wrong
this code works:
String r = "";
for(int i =1; i <= rows; i++)
{
for(int j = 1; j <=columns; j++)
{
r = r + " _";
r = r + "\n";
}
return r;
}
This code works and i get a square grid.
String r = "";
for(int i =1; i <= rows; i++)
{
for(int j = 1; j <=columns; j++)
{
if (( x1 == j) && (y1 == i))
{
r = r + " X";
}
else
{
r = r + " _";
r = r + "\n";
}
}
}
return r ;
The above code does not work and i don't know why, i want to make the same square grid but when the If condition is true i want to replace _ with X. Thx in advance for the help