I'm new to C# and working on a snake project. I'm trying to make it rainbow coloured, is there a better way to switch between six colours and then repeat?
public Brush Colour(int i)
{
Brush snakeColour;
switch (i)
{
case 0:
case 6:
case 12:
case 18:
case 24:
snakeColour = Brushes.HotPink;
break;
case 1:
case 7:
case 13:
case 19:
case 25:
snakeColour = Brushes.Orange;
break;
case 2:
case 8:
case 14:
case 20:
case 26:
snakeColour = Brushes.PeachPuff;
break;
etc.
default:
snakeColour = Brushes.White;
break;
}
return snakeColour;
}
Any suggestions?