mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +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
38b9bf7eed
commit
b1984042c8
@ -248,7 +248,8 @@ zur nächsten Zeile, ""Wahnsinn!"", die Massen waren kaum zu bändigen";
|
||||
// Ternärer Operator
|
||||
// Anstatt eines einfachen if/else lässt sich auch folgendes schreiben:
|
||||
// <condition> ? <true> : <false>
|
||||
string isTrue = true ? "Ja" : "Nein";
|
||||
int zumVergleich = 17;
|
||||
string isTrue = zumVergleich == 17 ? "Ja" : "Nein";
|
||||
|
||||
// while-Schleife
|
||||
int fooWhile = 0;
|
||||
|
@ -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;
|
||||
|
@ -234,7 +234,8 @@ on a new line! ""Wow!"", the masses cried";
|
||||
// Üçlü operatörler
|
||||
// Basit bir if/else ifadesi şöyle yazılabilir
|
||||
// <koşul> ? <true> : <false>
|
||||
string isTrue = (true) ? "True" : "False";
|
||||
int toCompare = 17;
|
||||
string isTrue = toCompare == 17 ? "True" : "False";
|
||||
|
||||
// While döngüsü
|
||||
int fooWhile = 0;
|
||||
|
@ -232,7 +232,8 @@ on a new line! ""Wow!"", the masses cried";
|
||||
// 三元表达式
|
||||
// 简单的 if/else 语句可以写成:
|
||||
// <条件> ? <真> : <假>
|
||||
string isTrue = (true) ? "True" : "False";
|
||||
int toCompare = 17;
|
||||
string isTrue = toCompare == 17 ? "True" : "False";
|
||||
|
||||
// While 循环
|
||||
int fooWhile = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user