1
0
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:
Guntbert Reiter
2015-10-04 16:44:24 +02:00
committed by G. Reiter
parent 38b9bf7eed
commit b1984042c8
4 changed files with 9 additions and 5 deletions

View File

@@ -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;