I'm writing a small C# console app, and I was wondering if there are ways to improve this part of code (particullary how to make it comply with the principle "Don't repeat yourself"). My app works fine with this construction too, but I don't like how it looks like.
if (rows % 2 == 0)
{
evenCell = '#';
oddCell = '.';
}
else
{
evenCell = '.';
oddCell = '#';
}
I'm a newbie so probably I'm missing something obvious. Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire