XOR in Featurescript?

EvanReese
EvanReese Member, Mentor Posts: 3,086 PRO
Is there a XOR operator like the OR operator? I'm looking for the best way to take a collection of booleans and return "false" if any of them are false, instead of only doing so if ALL of them are false.

For example, with OR it looks like
false || true || false = true;
but I'm trying to avoid doing this because it feels funny
false || !true || !false) = false;!(!
What is The Right And Good Way to do this?
Evan Reese
The Onsherpa | Reach peak Onshape productivity
www.theonsherpa.com

Answers

  • kevin_o_toole_1
    kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565 image
    I'm looking for the best way to take a collection of booleans and return "false" if any of them are false

    A && B && C...

    Is there a XOR operator?

    A != B

  • EvanReese
    EvanReese Member, Mentor Posts: 3,086 PRO
    I must have not been thinking clearly, because this seems obvious now, haha. Thanks, Kevin!
    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com