[Wtr-general] Else-if statements

Jeff Wood jeff.darklight at gmail.com
Wed Dec 14 19:27:50 EST 2005


Usually it's best to use a case statement if you start to have more
than if/else conditions.

case (do stuff)
  when (result1):
    ie.links[1].click
  when (result2):
    ie.links[2].click
  else:
    ie.links[3].click
end

It tends to make it easier to read & easier to extend should you ever
need additional conditions...

I highly recommend case ... there is a *LOT* of power inside those
"when" criteria.

j.

On 12/14/05, Torres, Ben (HQP) <Ben.Torres at rhi.com> wrote:
> Hi,
>
> What is the syntax I use for else-if statements?  I am using the code
> below, but I am getting an error:
>
> If cond1
>         ie.links[1].click
> Else-if cond2
>         ie.links[2].click
> Else
>         ie.links[3].click
> End
>
>
> Thanks in advance...
>
>
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>


--
"Remember. Understand. Believe. Yield! -> http://ruby-lang.org"

Jeff Wood




More information about the Wtr-general mailing list