Why do some ruby methods have Question Marks in their names?

Why does a lot of Ruby code seem to have a load of question marks at the end of method names? What does this mean?

At its simplest, the ? has no meaning whatsoever. It’s simply a legal character, like A or b or _.

However, there is a convention that you should add a question mark on the end of methods that return a true or false value.

For example, if you had an invoice, you may have a paid? method, for a person an is_logged_in? method and so on.

Do you know what to do but not how it works?

Ever wanted to understand why Rails views work the way that they do? Why variables from your controllers are visible inside your views?

Sign up below to get a free 5 part email course on how Ruby on Rails view rendering works and gain a deep understanding of the Rails magic.

We will send you the course, plus the occasional update from this web-site. But no spam, we promise, and it's easy to unsubscribe