XOR

August 20th, 2012

if a ^ b

What the hell is that carrot doing there? ….It’s an “exclusive or”.

It’s the same as saying:

(a && !b) || (!a && b)

which also means…


a | b |
0 | 0 | f
0 | 1 | t
1 | 0 | t
1 | 1 | f

Damn, useful… sometimes.

Entry Filed under: Professional,Ruby on Rails

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Pages

Tweets

Anyone else experience a little FOMO when you see the promo code text box?

About 3 months ago from Liana Leahy's Twitter via Twitter Web App

Meta

Recent Posts