Re: [exim] problem with ${if } in nested and {} condition

Top Page
Delete this message
Reply to this message
Author: Marten Lehmann
Date:  
To: exim-users
Subject: Re: [exim] problem with ${if } in nested and {} condition
Hello,

>> I need to build a condition with nested if-s, but I cannot get it work:
>>
>>      defer   condition     = ${if  and { \
>>                                            { \
>>                                                    ${if eq{}{} \
>>                                                    {true} \
>>                                                    {false} } \
>>                                            } \
>>                                            {eq{}{}} \
>>                                    } \
>>                               }

>
> You can't put the ${if inside there. What you_can_
> do is put "eq {} {}" there - which evaluates to a truth-value,
> which is part of the "and".


but as I explained: This doesn't work for me. I need nested conditions.
You cannot replace something like

if (whatever) {
    if (somewhat) {
        return true;
    } else {
        if (something) {
            return true;
        } else {
            return false;
        }
    }
} else {
    if (somewhat) {
        return true;
    } else {
        return false;
    }
}


by a simple and-condition.

The final logic in exim would be something like this:

${if  and { \
    { \
        ${if eq{}{} \
            {true} \
            { ${if eq{}{} \
                {true} \
                {false} \
            } } \
        } } \
    } \
    { \
        ${if eq{}{} \
            {true} \
            { ${if eq{}{} \
                {true} \
                {false} \
            } } \
        } } \
    } \
    } \
}


Since the above code does not work, I'm really interessed to see how
else I can "and" these if conditions.

Kind regards
Marten