sloppydog
07-02-2009, 08:28 PM
if I were to write a function/method like this:
public function myFunction(x:Number)
{
this.x = (x == undefined)?0:x;
}
what does this do:
?0:x
I am looking at various code bits from better programmers than I and came across this. My guess is that if x is undefined set this.x equal to 0 otherwise set it to x. But I am not 100 percent sure.
Thank you in advance for your help.
public function myFunction(x:Number)
{
this.x = (x == undefined)?0:x;
}
what does this do:
?0:x
I am looking at various code bits from better programmers than I and came across this. My guess is that if x is undefined set this.x equal to 0 otherwise set it to x. But I am not 100 percent sure.
Thank you in advance for your help.