I want to print the border of the square... It may print only one side, or more sides of the square, so , I write this method
printBorder(N, E, S, W) {
if (N) {
square.printBorder(0,0,0,10);
}
if (E) {
square.printBorder(0,10,10,10);
}
if (S) {
square.printBorder(10,0,10,10);
}
if (W) {
square.printBorder(0,0,10,0);
}
}
It can work fine, but I think it is not so elegant, it is too many if.... and all statement is more or less the same... ...I think it should have a way to simplify this codes, any suggestion?