Question about else statement
I've got this piece of code that says that a certain method works when the width is larger than the height:
Code :
for (int i=0; i<=(width); i++)
{
int diagonalRow = height-1;
for (int col=(width-height+i); col<width; col++)
{
int pixelColor= leftImage.getRGB(col,diagonalRow);
img.setRGB(col, diagonalRow, pixelColor);
diagonalRow--;
}
repaint();
try { Thread.sleep(10); } catch (InterruptedException e) { };
}
}
else
{
//Add code to consider image with larger height than width
}
How do I make it to work the same way if the height is larger than the width using the else statement?
Re: Question about else statement
I would write down on paper what ever "make it to work the same way" is, and get a good understanding of what has to be done. Then I would decide how to go about doing that task, and write those plans down on paper.
From there I would start working on the code.
Code was provided to give you hints. If yours is to "work the same way" then the given code is probably pretty close to what you need to be writing, right?