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 trial

Ruby Ruby Operators and Control Structures Ruby Control Structures The Ruby Else Statement

5 Answers

Ethan Lowry
PLUS
Ethan Lowry
Courses Plus Student 7,323 Points

'chomp' is a method belonging to the String class which removes content from the end of a given string. In its simplest usage, calling .chomp on a string will remove any trailing whitespace, new lines etc. on the end of that string.

You can see examples and read more about chomp and other String methods over in the docs.

Andy Saini
Andy Saini
5,287 Points

why are methods like .chomp used directly in treehouse videos without a proper introduction?

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

That is the one fault with the ruby courses, you don't know what some of the code is that he is using. The Ruby Foundations course was even worse; thankfully it was deprecated. If you want a more foundational understanding of Ruby, read Learn to Program by Chris Pine.

Andy Saini
Andy Saini
5,287 Points

I've seen similar behaviour with many other courses too..

Glad to hear I am not alone on this.