![]() ![]() A match expression must be of one of the following types: char, string, bool, an integral numeric type, or an enum type.In C# 6 and earlier, you use the switch statement with the following limitations: The switch statement supports pattern matching beginning with C# 7.0. The preceding example uses positional patterns with nested relational patterns. ") Ĭonsole.WriteLine("One or both measurements are not valid.") Void DisplayWeatherReport(double tempInCelsius)Ĭonsole.Write("Warning: not acceptable value! ") Ĭonsole.WriteLine($"The measurement value is. The switch statement: selects a statement list to execute based on a pattern match with an expression.Īn if statement can be any of the following two forms:Īn if statement with an else part selects one of the two statements to execute based on the value of a Boolean expression, as the following example shows: DisplayWeatherReport(15.0) // Output: Cold.ĭisplayWeatherReport(24.0) // Output: Perfect!.The if statement: selects a statement to execute based on the value of a Boolean expression.The following statements select statements to execute from a number of possible statements based on the value of an expression: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |