Wondering if there is a way to validate right on the input of the method? I realize I can easily do this later and throw an error but it would be nice if was caught compile time.
Instead of
CursorPosition(int x, int y)
{
if (x >= 80) { Console.WriteLine("off screen"); }
if (y >= 24) { Console.WriteLine("off screen"); }
}
Couldn't I just have it done here, and have the compiler throw back and error?
CursorPosition(int x < 80, y < 24)
{
// do stuff
}
Thanks so much!