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 Operators and Control Structures Ruby Operators Ruby Assignment Operators

kabir k
PLUS
kabir k
Courses Plus Student 18,036 Points

When to use the console and/or irb for Ruby

I want to be clear as to when to use the console and/or irb for working with the Ruby programming language.

Also, is the console the same as the terminal?

2 Answers

David Becerra
David Becerra
6,077 Points

You'll want to use the console or irb mostly when you're experimenting (at least in my case). Whenever you want to run some ruby either in a rails environment, a gem, or even a single ruby file.

I use it a lot to try out queries or when I'm brainstorming the interface of a feature i'm building. Usually a quick and dirty way that helps me explore.

The console is something you run in the terminal.

rowend rowend
rowend rowend
2,926 Points

I recommend you use irb when you want to test a few lines of code. I recommend you use console (ruby ruby_file_name.rb) when you want to make a bigger program.