If I have a function such as:
boolean test()
{
return a==b;
}
is it possible to initialize the return value of test to "false" the same way that you can initialize a boolean variable to "false"?
If I have a function such as:
boolean test()
{
return a==b;
}
is it possible to initialize the return value of test to "false" the same way that you can initialize a boolean variable to "false"?
Like this?
boolean test()
{
boolean returnValue = false;
returnValue = a==b;
return returnValue;
}
is it possible to initialize the return value of test to "false" the same way that you can initialize a boolean variable to "false"?
Yes. The way that return statement is written, though, initialization is not needed.
boolean test()
{
boolean status = false;
// do some diddling that might include changing the value of status
return status;
}
That is perfect! Thanks to the both of you!