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 Collections Build a Grocery List Program Build a Grocery List Program: Part 4

Parenthesis vs Brackets vs Curly Brackets

Hi - Is there a rule of thumb regarding when to use each character?

1 Answer


Yeah, you are right in thinking that. You are supposed to use curly braces and also parentheses in specific places in your program.

For example, parentheses are used after method names so that you can supply the method some parameters (variables to work with).

def hello()

Curly braces on the other hand are used to segment off code and define it's scope.

def hello() {


If you have any questions about any of the topics I covered above then don't hesitate to ask them.


Thanks for the examples, Luke. Starting to make more sense.

Awesome! Glad I managed to help you out.