Symbol Hound to the rescue!

18 Dec

In pursuit of learning Ruby (and Selenium Webdriver), I found myself wanting an explanation for an operator I saw in a bit of example code:

a <=> b

I tried searching in Google to no avail. The ‘<‘ and ‘>’ characters are stripped out and I wasn’t getting the query results I was looking for.

And then I found this:

In their own words:

“SymbolHound is a search engine that doesn’t ignore special characters. This means you can easily search for symbols like &, %, and π. We hope SymbolHound will help programmers find information about their chosen languages and frameworks more easily.”

Just paste it right in there and hit the shiny red Launch button. No fuss, no muss, and constructive answers up the wazoo. Okay, so there’s not really a ‘Launch’ button, but don’t hold this against them. It’s a great sight and really useful!

With the help of SymbolHound I found that the ‘<=>’ (aka ‘UFO’ ; ) operator does exactly what it looks like (?) and tells you if  is less than, equal to or greater than  b,  assuming that  a  is to the left of the operator and  b  is to the right. The response given for each, respectively is -1, 0 or 1. Kind of a Boolean operator with a little extra oomf. I haven’t found a use for this myself as yet, but I’m sure its benefits will become apparent in short order.

For now, I’ll just enjoy it for the cute little UFO it is, arriving just in time for the 2012 clash with the hidden planet Nibiru and the end of civilization as we know it.

Which reminds me. If you celebrate Christmas, may it be joyful and merry to the extreme. If you don’t, then Season’s Greetings and the very best of wishes to you and yours, and a very Happy New year!


Comments are welcome!

Fill in your details below or click an icon to log in: Logo

You are commenting using your 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: