So - late to the party, but from the original question
 Quote:
Why doesn't "If Ingroup ("groupA") = 0 or Ingroup ("GroupB") = 0" work when a user is in one group?
The answer is simple - the logic test is "TRUE" when a user is NOT in a group. With OR, if a user is not in either group, the action will be taken.

Using "If Ingroup()", as others have pointed out, tests the Boolean value rather than an explicit comparison. A statement such as "If X = 0" is counter-intuitive because the test is TRUE when the value being compared is FALSE. It's your brain, not the code, because you SEE zero and have been taught that Zero=False, you're not recognizing that the result of the comparison and not the compare value is what's being evaluated.

Follow the guidance above and ditch the specific return code comparisons.. use "If TEST" for any true and "If Not TEST" for any false triggered action, and leave the "=" for specific value tests.

Lastly, the examples in the KiXtart guide are at a primer level - they indicate what's explicitly returned. It's about interpreting the results.. if it returns just 1 or 0, treat it like a Boolean and you will generally be fine. Note that many of the earliest Kix functions and even many UDFs return 0 on SUCCESS and an error value on FAIL. That's counter to most app-dev processes that return a value of 1 on success, 0 on failure (if not returning specific data) so you can use the form
 Code:
If func()
  do stuff...
Else ; oops - failed!
  Error recovery based on @ERROR value
EndIf
With some 400+ functions now in our library, every one of them that doesn't return specific data is written to return a Bool True and Exit with 0 on success. Even functions that return strings can be tested this way by returning an empty string on function failure. Use unique Exit codes to represent specific failures rather than returning error messages from the function with generic Exit 1. It's much harder to process things that way.

Glenn


Edited by Glenn Barnas (2020-11-12 01:43 PM)
_________________________
Actually I am a Rocket Scientist! \:D