Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBam Wham
Courses Plus Student 539 PointsIt never said in the video that ?'s could be in the name of a method. It stated that lowercase, _ , and ! was allowed.
Am I missing something?
1 Answer
Andrew Stelmach
12,583 PointsI don't know if you're mistaken or not regarding the video contents, but question marks are very much approved of in Ruby.
However, the convention is that methods that have question marks must only return false
or true
, never anything else; they are therefore termed 'Boolean Methods' i.e. "Methods with question marks should only ever be Boolean Methods."
For example:
def tall?(person)
person.height > 180
end
andrew = Person.new(height: 170)
tall?(andrew)
=> false