mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-31 02:20:22 +02: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:
committed by
G. Reiter
parent
38b9bf7eed
commit
b1984042c8
@@ -239,7 +239,8 @@ sur une nouvelle ligne! ""Wow!"", quel style";
|
||||
// Opérateur ternaire
|
||||
// Un simple if/else peut s'écrire :
|
||||
// <condition> ? <valeur si true> : <valeur si false>
|
||||
string isTrue = (true) ? "True" : "False";
|
||||
int toCompare = 17;
|
||||
string isTrue = toCompare == 17 ? "True" : "False";
|
||||
|
||||
// Boucle while
|
||||
int fooWhile = 0;
|
||||
|
Reference in New Issue
Block a user