Is it possible to assign the result of a test directly to a variable?
I want to do something like
c = ( a == b )
instead of
if ( a == b )
{
c = true;
}
else
{
c = false;
}
Is this possible?
Is it possible to assign the result of a test directly to a variable?
I want to do something like
c = ( a == b )
instead of
if ( a == b )
{
c = true;
}
else
{
c = false;
}
Is this possible?
Yes, of course.
Which you can very easily test with the compiler.
int a = 1, b = 2;
bool c = a == b;