Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions “IF” in other “IF”

  • “IF” in other “IF”

    Posted by Eden Exposito on August 5, 2008 at 5:50 pm

    Hi

    How i can put a logical expression “IF” in other “IF”
    Eg:

    line1: If (a!=b)
    line2: {If (b!=c){d=1} else {d=2}}
    line3: else
    line4: {If (b=c) {d=3} else {d=4}}

    After effect tell me an error in line3…. Other method for do this?

    Thanks

    Eden Exposito replied 17 years, 9 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    August 5, 2008 at 8:38 pm

    Looks like you were close. You need “if” instead of “If” and “==” is the equivalence operator, not “=”.

    This works for me:

    if (a!=b){
    if (b!=c){
    d=1
    }else{
    d=2
    }
    }else{
    if (b==c){
    d=3
    }else{
    d=4
    }
    }

    Dan

  • Eden Exposito

    August 6, 2008 at 7:23 am

    Hi dan!
    First of all, thanks for yours replies, but i dont found solution with the problem “if in other if”, here is my code.

    THIS CODE RETURN ME A WARNING: “EXPECTED: ; AT LINE 7” WHY????

    n=(Math.round(thisComp.layer(“Control Layer”).effect(“Numero_de_decimales”)(“Slider”)))+3;
    m=thisComp.layer(“Control Layer”).effect(“Escala”)(“Slider”);
    caracteres_unidades=thisComp.layer(“ESCRIBE LAS UNIDADES Y OCULTAME”).text.sourceText;
    MostrarUnidadesIndice=thisComp.layer(“Control Layer”).effect(“Mostrar_Unidades_Indice”)(“Checkbox”);

    if (m!=0){
    If (MostrarUnidadesIndice==1){
    (text.sourceText=((1/m).toFixed(n))*100)+(” “)+(caracteres_unidades);
    }else{
    {(text.sourceText=((1/m).toFixed(n))*100);}
    }else{
    If (MostrarUnidadesIndice==1){
    (text.sourceText=((1).toFixed(n))*100)+(” “)+(caracteres_unidades);
    }else{
    (text.sourceText=((1).toFixed(n))*100);}
    }

  • Eden Exposito

    August 6, 2008 at 11:13 am

    ok “IF” not im silly!! is “if” in lower case… sorry

    All work now
    THANKS

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy