When both ‘true’ and ‘false’ are right

I ran into very interesting logic issue. Probably if someone asks me what case it was, then I would not be able to recall this, because it’s subtle ( but simple ).

bool vaFacebookAPI::HandleResponse(zuint32 what, zRecord *record, zRecord *current, zRecord *previous)
{
    bool isHandled = true;

    if (record == nullptr || current == nullptr) {

        // You can think of this as 'handled' or 'not handled' depending on
        // how you think. But architecturally it should be treated as 'not handled'
        return false; // ๐Ÿ‘ˆ๐Ÿผ This case 
    }

    ...
}

1. You can think that it can return ‘true’, because such case is considered and you decided not to do anything. So, It’s handled as such. So, it’s right to be ‘true’.

2. You can think it it can return ‘false’, because for that case nothing is processed and just returns. So, you can regard it as ‘not handled’. So, ‘false’ is correct.

Interesting, isn’t it?
One logic, depending on how you think it can be thought as ‘true’ and ‘false’

So, true is true, and false is also true. ๐Ÿ˜‰

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: