# Is there a way to run a obj.each loop in the script/console?

**URL:** <https://www.ruby-forum.com/t/is-there-a-way-to-run-a-obj-each-loop-in-the-script-console/163386>\
**Category:** Rails\
**Created:** [March 19, 2009, 7:33pm UTC](https://www.ruby-forum.com/t/is-there-a-way-to-run-a-obj-each-loop-in-the-script-console/163386 "2009-03-19T19:33:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![farfignugen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@farfignugen](https://www.ruby-forum.com/u/farfignugen)\
**Post date:** [March 19, 2009, 7:33pm UTC](https://www.ruby-forum.com/t/is-there-a-way-to-run-a-obj-each-loop-in-the-script-console/163386/1 "2009-03-19T19:33:43Z")

</div>

is there a way to run a obj.each loop in the script/console?

---

<div class="post-metadata">

**Author:** ![farfignugen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@farfignugen](https://www.ruby-forum.com/u/farfignugen)\
**Post date:** [March 19, 2009, 7:37pm UTC](https://www.ruby-forum.com/t/is-there-a-way-to-run-a-obj-each-loop-in-the-script-console/163386/2 "2009-03-19T19:37:54Z")

</div>

Chris G. wrote:

> is there a way to run a obj.each loop in the script/console?

Why not. just use it as you do with each loop.

> > @a=Class.find(:all)  
> > @a.each do  
> > ?\> yourstuff…
> 
> > end

---

<div class="post-metadata">

**Author:** ![farfignugen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@farfignugen](https://www.ruby-forum.com/u/farfignugen)\
**Post date:** [March 19, 2009, 7:43pm UTC](https://www.ruby-forum.com/t/is-there-a-way-to-run-a-obj-each-loop-in-the-script-console/163386/3 "2009-03-19T19:43:03Z")

</div>

cool cool thanks…

> > > @a=Class.find(:all)  
> > > @a.each do  
> > > ?\> yourstuff…
> > 
> > > end

---

<div class="post-metadata">

**Author:** ![farfignugen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@farfignugen](https://www.ruby-forum.com/u/farfignugen)\
**Post date:** [March 19, 2009, 11:26pm UTC](https://www.ruby-forum.com/t/is-there-a-way-to-run-a-obj-each-loop-in-the-script-console/163386/4 "2009-03-19T23:26:53Z")

</div>

On Thu, Mar 19, 2009 at 11:33 AM, Chris G.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> is there a way to run a obj.each loop in the script/console?

Yes, just type it in like you would anywhere else – unless I’m totally  
missing your actual question 🙂

–  
Hassan S. ------------------------ removed\_email\_address@domain.invalid
