Difference between revisions of "In InitialiseField the question to load an existing file only accepts Y and not y"
(Created page with "<syntaxhighlight lang=csharp line> static void InitialiseField(char[,] Field) { string Response = ""; Console.Write("Do you want to load a file with seed posit...") |
|||
Line 15: | Line 15: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | ==Explanation== | ||
+ | |||
+ | Line 6: Added .ToLower() in the if statement which means both 'Y' and 'y' will be treated as a lower case 'y' |
Latest revision as of 10:20, 13 March 2017
1 static void InitialiseField(char[,] Field)
2 {
3 string Response = "";
4 Console.Write("Do you want to load a file with seed positions? (Y/N): ");
5 Response = Console.ReadLine();
6 if (Response.ToLower() == "y")
7 {
8 ReadFile(Field);
9 }
10 else
11 {
12 CreateNewField(Field);
13 }
14 }
Explanation
Line 6: Added .ToLower() in the if statement which means both 'Y' and 'y' will be treated as a lower case 'y'