I'm looking at some code that I want to modify to use on a project I'm using an arduino to control.
I have no idea what ?0:1 means.
The line is f = (fxy < 0) ? 0 : 1;
My guess is the inverse of.
It complies using the arduino IDE.
Thanks.
I'm looking at some code that I want to modify to use on a project I'm using an arduino to control.
I have no idea what ?0:1 means.
The line is f = (fxy < 0) ? 0 : 1;
My guess is the inverse of.
It complies using the arduino IDE.
Thanks.
This is functionally equivalent...
if ( fxy < 0 )
{
f = 0;
}
else
{
f = 1;
}
Does that help?
The ? : is called "conditional operator"...
Is called a ternary IF statement
(fxy < 0) ? 0 : 1;
is the same as:
if(fxy < 0)
{
// if condition is true
return 0;
}
else
{
// otherwise condition is false
return 1;
}
Edit: CodingBadly Answered it first.