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 Introducing the Practice

CWong Da
CWong Da
598 Points

Sometimes I wish to delete a previous step, but the clear command would delete everything I've inputed. What should I do

Sometimes I wish to delete a previous step, but the clear command would delete everything I've inputed. What should I do instead?

1 Answer

Jay McGavren
STAFF
Jay McGavren
Treehouse Teacher

This is going to seem like a very low-tech solution, but here's what I do whenever I need to refer to some other text when typing in new code: I paste it right into the same editor so I can refer to it, then delete it after I've made my edits. So select all your old code, and hit Copy/Ctrl-C. Do the "clear" command. Then paste your code in, right below the code you're editing. You can comment the old code out if you want, or just make sure to delete it before running your new code.

Works great for me, and it's much less of a mental burden than flipping between windows!

By the way, secret tip for Treehouse code challenges: code that's passing Task 2 (or later) of a challenge will almost always pass Task 1 as well. So if you copy your Task 2 code and switch back to Task 1, it should still work.