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 Foundations Arrays Iteration

Multiple line input in the terminal (Mac)

I'm having a hard time learning how to input multiple lines of code into the terminal.

Right now I'm working on Ruby foundations: Iterations.

Thank you!

6 Answers

I entered irb --simple-prompt, then entered my code and it worked like a charm!!

Thank you for your help!

You're welcome.

You can use back-slash \ at the end of line to write multiple lines. For example:

>> a = 1 \
>> + 2
=> 3

Yeah its pretty weird because it will go to the next line with this : irb(main):007:1*

If you want to get rid of prompt things, you can start irb with --simple-prompt option. Like irb --simple-prompt

Not actually weird. If an irb line prompt ends with a " * " instead of " > ", it means you're continuing.

I'm not seeing >>, I have irb(main):002:0> instead

Ok you can think >> as irb(main):002:0>. Did you try to use backslash?

That's what I thought as well.

Ok well then must be something wrong with my code.