mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
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.
This commit is contained in:
parent
9b46fe7e57
commit
f1a90a4e63
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user