Posts

Showing posts from July, 2010

Initialing a boolean variable thru comparison operator

There are time when we try to compare and the point is only to initialize a boolean variable. Sample, if(var1 == var2) {   bVar = true; } else {   bVal = false; } So, instead of the long code above you can shorten it to: bVar = (var1 == var2); That's it!