Menu

How to evaluate only nedded rules? (dont evaluate second if first is false)

Help
2018-12-26
2018-12-28
  • Jean Robert

    Jean Robert - 2018-12-26

    What is the best way to make a rule in wich only the nedded rules is evaluated. Say i have this logic "personIsValid() && personIsClient()".
    If personIsValid return false, then personIsClient can't be called. (it will use some paid services)

     
  • OpenL Tablets

    OpenL Tablets - 2018-12-28

    Hello,
    Logic "personIsValid() && personIsClient()" works exactly the way you described. If personIsValid() returns false, then personIsClient() is not executed.
    Another option is using ternary operation personalValid() ? personIsClient():false.
    But the best practive would be putting second condition in return column (see ReturnTest3 as example).

    Best Regards,
    Alena.

     

    Last edit: OpenL Tablets 2018-12-29

Log in to post a comment.