--000e0cd215284516ac0462798c2c
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Mon, Feb 9, 2009 at 4:22 AM, Gor Sebesty <segabor / gmail.com> wrote:

> For instance, I want to decide whether the conditional expressions of
> two subsequent IFs are the same (or equivalent). I know it's not easy
> in most cases.
>
> Let's see a primitive example:
>
>  if A then
>   do_something1
>  end
>
>  if B
>    do_something2
>  end
>
> If A and B equals their conditional branches could be joined.
>
> I'm investigating how it would be easy to evaluate whether A and B
> are both true and/or false.
> I need this in my refactoring experiment.
>
> Gor
>

if A && B then
  "bingo"
elsif(A) then
  "bango"
elsif(B)
  "bongo"
else
  nil
end

This is just a guess, but you could also use a nested if or a case.
case(a)
  when !a | b then "a=t, b=t"
  when !(a & b) then "a=t, b=f"
  when !(a | b) then "a=f, b=t"
  when !a & b then "a=f, b=f"
end

But that would be wierd.

case(


> On Sun, Feb 8, 2009 at 11:43 AM, Robert Dober <robert.dober / gmail.com>
> wrote:
> > On Sun, Feb 8, 2009 at 11:03 AM, Gor Sebesty <segabor / gmail.com>
> wrote:
> >> Hi,
> >>
> >> I want to examine conditional expressions and I'm looking for tools to
> do it.
> >> It would be perfect to do it purely in ruby or even in jruby.
> >>
> >> Any recommendations are apprecitated.
> >>
> >> Gor
> >>
> > I am not sure what a conditional expression is, care to give some
> examples?
> > Robert
> >
> >
>
>


-- 
The UNIX system has a command, nice ... in order to be nice to the other
users. Nobody ever uses it." - Andrew S. Tanenbaum

--000e0cd215284516ac0462798c2c--