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

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Marten Lehmann
Dátum:  
Címzett: exim-users
Tárgy: 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