3 manières de dire If Then Else

Publié le par Chief

Dans certains cas, la manière classique pour écrire If Then Else est "limitée"

La manière classique:

if (a==b)

{

       b=c;

}

else

{

       b=d;

}

 

La manière en une seule ligne avec opérateurs conditionnel:

 

b= a==b ? b=c :b=d;

 

La manière en une seule ligne  avec et / ou

 

b= a==b && c || d;

 

Plus d'informations:

http://www.thomasfrank.se/3_ways_2_say_if.html

Publié dans .NET

Pour être informé des derniers articles, inscrivez vous :
Commenter cet article