# Do loops and braces

**URL:** <https://www.ruby-forum.com/t/do-loops-and-braces/98975>\
**Category:** Ruby\
**Created:** [July 19, 2006, 2:11pm UTC](https://www.ruby-forum.com/t/do-loops-and-braces/98975 "2006-07-19T14:11:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aidy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eada6e/32.png) [@aidy](https://www.ruby-forum.com/u/aidy)\
**Post date:** [July 19, 2006, 2:11pm UTC](https://www.ruby-forum.com/t/do-loops-and-braces/98975/1 "2006-07-19T14:11:17Z")

</div>

Is there anyway I can envelop this in braces and not have a loop ‘end’?

def goto\_territory\_list  
ObjectMap.new.instance\_eval do  
sales\_admin\_link.click  
territories\_link.click  
end  
end

Thanks

Aidy

---

<div class="post-metadata">

**Author:** ![aidy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eada6e/32.png) [@aidy](https://www.ruby-forum.com/u/aidy)\
**Post date:** [July 19, 2006, 2:21pm UTC](https://www.ruby-forum.com/t/do-loops-and-braces/98975/2 "2006-07-19T14:21:02Z")

</div>

On Wednesday 19 July 2006 21:10, aidy wrote:

> Is there anyway I can envelop this in braces and not have a loop ‘end’?

just do it 🙂  
though it’s common practice to use do … end for blocks over more than  
one  
line

---

<div class="post-metadata">

**Author:** ![aidy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eada6e/32.png) [@aidy](https://www.ruby-forum.com/u/aidy)\
**Post date:** [July 19, 2006, 4:15pm UTC](https://www.ruby-forum.com/t/do-loops-and-braces/98975/3 "2006-07-19T16:15:21Z")

</div>

On Wed, 19 Jul 2006, Michael F. wrote:

> On Wednesday 19 July 2006 21:10, aidy wrote:
> 
> > Is there anyway I can envelop this in braces and not have a loop ‘end’?
> 
> just do it 🙂  
> though it’s common practice to use do … end for blocks over more than one  
> line

I find that slightly annoying as well. When I use brackets, text editors  
like emacs, jEdit, etc, will show me how each bracket matches up to a  
previous bracket, but they will not show the “do” that matches up with  
an  
“end” when I type it.

If I have many nested if, while, do, etc, statements, the only way to  
overcome this disability is to comment end tokens (and keeping track of  
these comments over a mutli-version distribution can be very time  
consuming, and error-prone.)

Nate
