do loops and braces

A

aidy

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
 
M

Michael Fellinger

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
 
N

Nathan Smith

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top