mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-24 15:23:09 +02:00
Merge pull request #1339 from guntbert/iss1333
[csharp/en] Put demonstrative condition into ternary expression
This commit is contained in:
@@ -236,7 +236,8 @@ on a new line! ""Wow!"", the masses cried";
|
||||
// Ternary operators
|
||||
// A simple if/else can be written as follows
|
||||
// <condition> ? <true> : <false>
|
||||
string isTrue = (true) ? "True" : "False";
|
||||
int toCompare = 17;
|
||||
string isTrue = toCompare == 17 ? "True" : "False";
|
||||
|
||||
// While loop
|
||||
int fooWhile = 0;
|
||||
|
Reference in New Issue
Block a user