a= a >0 ? a : 0;

what does this mean?
thanks

That is "shorthand" for this:

if (a > 0)
  a = a;
else
  a = 0;

Look up the ternary operator for more info.

You can think of the ternary operator as this :

if( condition )
  return firstArgument;
else return secondArgument;

//which is equivalent to this :
condition ? firstArgument : secondArgument;

So when you do something like this :

var arg = condition ? firstArgument : secondArgument;

it basically reads as, the variable 'arg' equals to the value returned by the
ternary argument. If condition is true, then the value of the ternary operator is firstARgument, else the value of the ternary operator is the secondArgument.

Its basically what Fbody said above but more generalized.

The key to getting started with this statement is the order of operator precedence. Memorize it until you learn it: PUMAS REBL CAC.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.