Skip to content

Conversation

@darkness198
Copy link

No description provided.

Copy link
Contributor

@ryan-hamblin ryan-hamblin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done!

// return true if num is even
// otherwise return false
// code here
return !(num % 2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting approach. I'd like to see your thoughts behind coming up with this solution? Was it trial and error? Just found out that num % 2 gives us zero which is an undefined value so you can turn it to it's opposite which is True? Interesting.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some experience in c++ makes me use the NOT operator naturally, and it worked the first time I put it in. Interesting I didn't really think about it being undefined, I thought of it as 0, which in my mind is false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants