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 trialDavid McGraw
Courses Plus Student 9,711 PointsMultiple 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
David McGraw
Courses Plus Student 9,711 PointsI entered irb --simple-prompt, then entered my code and it worked like a charm!!
Thank you for your help!
sitkibagdat
27,311 PointsYou can use back-slash \
at the end of line to write multiple lines. For example:
>> a = 1 \
>> + 2
=> 3
David McGraw
Courses Plus Student 9,711 PointsYeah its pretty weird because it will go to the next line with this : irb(main):007:1*
sitkibagdat
27,311 PointsIf you want to get rid of prompt things, you can start irb with --simple-prompt
option. Like irb --simple-prompt
sitkibagdat
27,311 PointsNot actually weird. If an irb line prompt ends with a " * " instead of " > ", it means you're continuing.
David McGraw
Courses Plus Student 9,711 PointsI'm not seeing >>, I have irb(main):002:0> instead
sitkibagdat
27,311 PointsOk you can think >>
as irb(main):002:0>
. Did you try to use backslash?
David McGraw
Courses Plus Student 9,711 PointsThat's what I thought as well.
Ok well then must be something wrong with my code.
sitkibagdat
27,311 Pointssitkibagdat
27,311 PointsYou're welcome.