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

@ -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;
@ -886,4 +887,4 @@ zur nächsten Zeile, ""Wahnsinn!"", die Massen waren kaum zu bändigen";
* [ASP.NET Web Forms Tutorials](http://www.asp.net/web-forms/tutorials)
* [Windows Forms Programming in C#](http://www.amazon.com/Windows-Forms-Programming-Chris-Sells/dp/0321116208)
[C# Coding Conventions](http://msdn.microsoft.com/de-de/library/vstudio/ff926074.aspx)
[C# Coding Conventions](http://msdn.microsoft.com/de-de/library/vstudio/ff926074.aspx)

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;

View File

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

View File

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