Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby Ruby Basics Objects Calling Methods on an Object

Juli Hope
PLUS
Juli Hope
Courses Plus Student 66 Points

i got a question, create any string you want, call the length of it and use the .even? method on any integer you want

i wrote def hello(string) n/ string.length n/ end puts hello AND def even(int) n/ int.even? n/ end n/ puts even end. could you please tell me what i should be inputting??

1 Answer

William Li
PLUS
William Li
Courses Plus Student 26,865 Points

You don't have to define a method for this challenge, actually doing so will cause the challenge to fail.

# Create any string you want, and call the length method on it
s = 'whatever'.length

# call the even? method on any integer you want.
3.even?

that's pretty much all you need to do to finish the task.