From f1a90a4e636616ce91a271504eee3f374bfd7094 Mon Sep 17 00:00:00 2001 From: Guntbert Reiter Date: Sun, 4 Oct 2015 16:44:24 +0200 Subject: Put demonstrative condition into ternary expression It should be made clear that the part before the ternary operator is indeed a condition, most often created as some comparison expression. --- csharp.html.markdown | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'csharp.html.markdown') diff --git a/csharp.html.markdown b/csharp.html.markdown index 479b7f01..222ba0d2 100644 --- a/csharp.html.markdown +++ b/csharp.html.markdown @@ -236,7 +236,8 @@ on a new line! ""Wow!"", the masses cried"; // Ternary operators // A simple if/else can be written as follows // ? : - string isTrue = (true) ? "True" : "False"; + int toCompare = 17; + string isTrue = toCompare == 17 ? "True" : "False"; // While loop int fooWhile = 0; -- cgit v1.2.3