Loading ...
Sorry, an error occurred while loading the content.

lbound & ubound equivalent in RoR

Expand Messages
  • nitinuprit
    hi everyone, can anybody from MS technologies background tell me the equivalent of LBound & UBound functions in Rails? Also, how do we write the following
    Message 1 of 2 , Oct 13, 2006
    • 0 Attachment
      hi everyone,

      can anybody from MS technologies background tell me the equivalent of
      LBound & UBound functions in Rails?

      Also, how do we write the following VBScript loop in Rails:

      For i = LBound(x) To UBound(x)
      ...
      Next

      Googled and all but in vain. any help will be appreciated!

      cheers!

      - NU
    • Martin DeMello
      ... If you describe what lbound and ubound do, even people without an ms technologies background can help :) ... assuming you mean in a view:
      Message 2 of 2 , Oct 27, 2006
      • 0 Attachment
        On 10/13/06, nitinuprit <nitinuprit@...> wrote:
        >
        > hi everyone,
        >
        > can anybody from MS technologies background tell me the equivalent of
        > LBound & UBound functions in Rails?

        If you describe what lbound and ubound do, even people without an ms
        technologies background can help :)

        > Also, how do we write the following VBScript loop in Rails:
        >
        > For i = LBound(x) To UBound(x)
        > ...
        > Next

        assuming you mean in a view:

        <% LBound(x).upto(UBound(x)) do |i| %>

        bunch of code that can use i as a variable

        <% end %>

        in normal ruby code it's just

        LBound(x).upto(UBound(x)) do |i|
        whatever
        end

        martin
      Your message has been successfully submitted and would be delivered to recipients shortly.