Amor Ternari

No puc ocultar-ho el meu amor per l’operador ternari és infinit. Els exemples parlen per si mateix.

Sense operador ternari:

   1:  if (condition)
   2:  {
   3:      Console.WriteLine("Something");
   4:  }
   5:  else
   6:  {
   7:      Console.WriteLine("Something Else");
   8:  }


Amb operador ternari

   1:  Console.WriteLine(condition ? "Something" : "Something Else");

El que deia amor pur i dur ;P

0 comments ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

Powered by WP Hashcash