2.6: Ternary Operators
File Location
About
class Program
{
static void Main(string[] args)
{
int number = 10;
//1 //2 //3 //4
string response = ((number == 7) ? "The number is 7." : "The number is not 7.");
Console.WriteLine(response);
}
}Discussion
Last updated