Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

XOR in Featurescript?

EvanReeseEvanReese Member, Mentor Posts: 2,079 ✭✭✭✭✭
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

Answers

  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    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

  • EvanReeseEvanReese Member, Mentor Posts: 2,079 ✭✭✭✭✭
    I must have not been thinking clearly, because this seems obvious now, haha. Thanks, Kevin!
    Evan Reese
Sign In or Register to comment.