Most programming languages have a Data Type called “Boolean”. This is a form of data with only two possible values (usually “true” and “false”). The Ruby language however does not have a Boolean Data Type. Ruby has Boolean Methods, otherwise called Predicates or Query. These are methods that end with a question mark (?) . It will be worth noting that only " false" and " nil " values evaluate to false in Ruby. Let's take the example of the all? Boolean method; .all? { word.length >= } .all? { word.length >= } .all?( ) [ , i, ].all?(Numeric) [ , , ].all? [].all? %w[ant bear cat] |word| 3 #=> true %w[ant bear cat] |word| 4 #=> false %w[ant bear cat] /t/ #=> false 1 2 3.14 #=> true nil true 99 #=> false #=> true The all? method passes each element of the collection to the given block. The method returns true if the block never returns false or nil. If the block is not given, Ruby adds an implicit block of { |obj| obj } which will cause to return true when none of the collection members are false or nil. all? If instead a pattern is supplied, the method returns whether pattern === element for every collection member. It is a similar case with the any? method .any? { word.length >= } .any? { word.length >= } .any?( ) [ , , ].any?(Integer) [ , , ].any? [].any? %w[ant bear cat] |word| 3 #=> true %w[ant bear cat] |word| 4 #=> true %w[ant bear cat] /d/ #=> false nil true 99 #=> true nil true 99 #=> true #=> false From the above examples, we can conclude that the question mark (?) at the end of the method is set when we have a method that returns Boolean values — ‘true’ or ‘false’. Creating Boolean Methods Apart from the Boolean methods provided by Ruby, you can as well create your own Boolean Methods. For example; (x % ) == (x % ) == (x % ) == x < puts is_even?( ) puts is_even?( ) puts is_odd?( ) puts is_odd?( ) puts multiples_of_five?( ) puts multiples_of_five?( ) puts less_than_three?( ) puts less_than_three?( ) def is_even? (x) 2 0 end def is_odd? (x) 2 1 end def multiples_of_five? (x) 5 0 end def less_than_three? (x) 3 end 2 3 2 3 3 5 2 4 This will result in the following true false false true false true true false To conclude, we have learnt that; Methods that end with the question mark (?) are called Boolean methods; Boolean methods must return true or false; You can create your own Boolean methods in Ruby