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 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.