which would be better if i do this:
if(message == \'redirect\')
{
is_valid.accepted = true;
}
else if(message == \'invalid id\')
{
is_valid.accepted
If you go with the if statement, I personally prefer setting default values above the if, like this:
is_valid.accepted = false;
if(message == 'redirect')
{
is_valid.accepted = true;
}
That way, you always default to a safe behavior that is less likely to break if you add more options later on. Also, you see the default behavior at a glance without having to read through the if-then-else logic. And it's much shorter code.