Illustrates the use of the ternary operator

image_pdfimage_print

/*
Mastering Visual C# .NET
by Jason Price, Mike Gunderloy

Publisher: Sybex;
ISBN: 0782129110
*/

/*
Example3_5.cs illustrates the use of
the ternary operator
*/

public class Example3_5
{

public static void Main()
{

int result;

result = 10 > 1 ? 20 : 10;
System.Console.WriteLine(“result = ” + result);

result = 10 < 1 ? 20 : 10; System.Console.WriteLine("result = " + result); } } [/csharp]