do loops and braces

Discussion in 'Ruby' started by aidy, Jul 19, 2006.

  1. aidy

    aidy Guest

    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
     
    aidy, Jul 19, 2006
    #1
    1. Advertising

  2. 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
    >
    > def goto_territory_list
    > ObjectMap.new.instance_eval do
    > sales_admin_link.click
    > territories_link.click
    > end
    > end
    >
    > Thanks
    >
    > Aidy
     
    Michael Fellinger, Jul 19, 2006
    #2
    1. Advertising

  3. aidy

    Nathan Smith Guest

    On Wed, 19 Jul 2006, Michael Fellinger 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
     
    Nathan Smith, Jul 19, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dustin D.
    Replies:
    0
    Views:
    2,308
    Dustin D.
    Aug 27, 2003
  2. bric

    brackets, braces and arrays

    bric, Jul 5, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    482
  3. v4vijayakumar

    braces fixed '#{' and '#}'

    v4vijayakumar, Jan 17, 2009, in forum: Python
    Replies:
    6
    Views:
    309
    Tim Roberts
    Jan 20, 2009
  4. Rustom Mody

    reifying indent and dedent into braces

    Rustom Mody, Oct 13, 2009, in forum: Python
    Replies:
    4
    Views:
    351
  5. Me
    Replies:
    2
    Views:
    247
Loading...

Share This Page