Ternary operator
/*
Learning C#
by Jesse Liberty
Publisher: O'Reilly
ISBN: 0596003765
*/
using System;
public class ThreeInputValues
{
static void Main()
{
int valueOne = 10;
int valueTwo = 20;
int maxValue = valueOne > valueTwo ? valueOne : valueTwo;
Console.WriteLine("ValueOne: {0}, valueTwo: {1}, maxValue: {2}",
valueOne, valueTwo, maxValue);
}
}
Related examples in the same category