Reason #21 • January 21st, 2026

Question-marked boolean methods

In idiomatic Ruby, methods that return boolean values are typically named with a question mark at the end. This convention nicely removes the need to prefix method names with "is" or "has", as is common in other programming languages.

Ruby
5.integer?
# => true

3.14.integer?
# => false

{ hello: "world" }.key?(:hello)
# => true

{ hello: "world" }.key?(:goodbye)
# => false
      
JavaScript
Number.isInteger(5);
// => true

Number.isInteger(3.14);
// => false

Object.hasOwn({ hello: "world" }, "hello");
// => true

Object.hasOwn({ hello: "world" }, "goodbye");
// => false
      

This convention both clarifies intention and condenses method names, all while doing it using intuitive human language syntax.

History

The question mark convention appears to have been part of Ruby since the very beginning. The only other language before Ruby with a documented question mark convention I could find is the Lisp dialect Scheme.

After Ruby, languages that adopted similar conventions include Clojure, Crystal and Elixir.