[To...] Posted October 2, 2020 Share Posted October 2, 2020 Is using an "and" in a "if" statement possible? Point1_Z_value_LE=getActual("Point1").z Point2_Z_value_LE=getActual("Point2").z Point3_Z_value_LE=getActual("Point3").z Point1_Z_value_LE_abs=abs(getActual("Point1").z-0.415) Point2_Z_value_LE_abs=abs(getActual("Point2").z-0.415) Point3_Z_value_LE_abs=abs(getActual("Point3").z-0.415) if Point1_Z_value_LE_abs>Point2_Z_value_LE_abs and Point1_Z_value_LE_abs>Point3_Z_value_LE_abs then MAXDev_LE=Point1_Z_value_LE endif if Point2_Z_value_LE_abs>Point1_Z_value_LE_abs and Point2_Z_value_LE_abs>Point3_Z_value_LE_abs then MAXDev_LE=Point2_Z_value_LE endif if Point3_Z_value_LE_abs>Point1_Z_value_LE_abs and Point3_Z_value_LE_abs>Point2_Z_value_LE_abs then MAXDev_LE=Point3_Z_value_LE endif Link to comment Share on other sites More sharing options...
[Cl...] Posted October 2, 2020 Share Posted October 2, 2020 What happens when you execute it? An error should pop up if not allowed. Link to comment Share on other sites More sharing options...
[Da...] Posted October 2, 2020 Share Posted October 2, 2020 In my experience that doesn't always work. The safe way is a separate statement: ... if Point1_Z_value_LE_abs>Point2_Z_value_LE_abs then MAXDev_LE=Point1_Z_value_LE endif if Point1_Z_value_LE_abs>Point3_Z_value_LE_abs then MAXDev_LE=Point1_Z_value_LE endif ... Link to comment Share on other sites More sharing options...
[To...] Posted October 2, 2020 Author Share Posted October 2, 2020 Please sign in to view this quote. Screenshot 2020-10-02 142457.jpg Link to comment Share on other sites More sharing options...
[Cl...] Posted October 2, 2020 Share Posted October 2, 2020 Is that before, or after Daniels suggestion? Link to comment Share on other sites More sharing options...
[To...] Posted October 2, 2020 Author Share Posted October 2, 2020 Please sign in to view this quote. Before Link to comment Share on other sites More sharing options...
[Er...] Posted October 2, 2020 Share Posted October 2, 2020 You need to isolate the precedence of the boolean expressions from the if-statement. In english: if (a < b) and (d > c) display("Joey Buttafucko") endif Link to comment Share on other sites More sharing options...
[To...] Posted October 2, 2020 Author Share Posted October 2, 2020 Please sign in to view this quote. 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 Link to comment Share on other sites More sharing options...
[He...] Posted October 4, 2020 Share Posted October 4, 2020 Eric is correct. (Except for the first part where he just uses some random words he read on Github 🙂.) Link to comment Share on other sites More sharing options...
[Er...] Posted October 5, 2020 Share Posted October 5, 2020 Please sign in to view this quote. Hahahaha, I'm educated by you.. 😉 Well, I should have said, you have to force precedence of the boolean expression before the if-statement everytime "and" or "or" is included 🙂 I'm pretty useless at English. Guess I was more intrested in beer and tits in school. 🙄 Link to comment Share on other sites More sharing options...
[Is...] Posted October 5, 2020 Share Posted October 5, 2020 Have you noticed this?: a=1 b=2 c=3 d=4 ///// no error: if a < b and d > c then display("True") else display("False") endif if a < b and d < c then display("True") else display("False") endif //////// syntaxis error when first condition is false: if a > b and d < c then display("True") else display("False") endif if a > b and d > c then display("True") else display("False") endif Link to comment Share on other sites More sharing options...
[To...] Posted October 5, 2020 Author Share Posted October 5, 2020 Please sign in to view this quote. I don't understand what the problem is.... Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in