Cover image for Twiddle-wakka (Yes, that's a real thing)

Twiddle-wakka (Yes, that's a real thing)

drbragg profile image Drew Bragg ・1 min read

You may or may not know that Ruby has a pessimistic operator:


It's actually a pretty cool little thing used in Gemfiles to specify a version range.

gem 'rails', '~> 5.2.1'
gem 'devise', '~> 4.6'
gem 'puma', '~> 3'

is the same as specifying:

gem 'rails', '>= 5.2.1', '< 5.3.0'
gem 'devise', '>= 4.6.0', '< 5.0'
gem 'puma', '>= 3.0', '< 4.0'

But what is even better about it is it's name. ~> is called a twiddle-wakka

I hope you laughed as much at this as I did.

Happy Friday!


Editor guide

This ranks right up there IMO with Python calling it's new := operator the 'walrus operator'.