# How do I say that something must happen or another thing, not both, in one simple sentence?

I'd guess `as opposed to` but I'm not sure.

This property must be set as opposed to X (one or another, not both)

How can this can be better?

-

I don't think "as opposed to" does what you want here. Instead of "one or the other, but not both," it means "this one, not that one."

How about: The property must be set as either X or Y. ("Either" suggests that the "or" isn't inclusive.)

-
+1 for "Either" implies that the "or" isn't inclusive – Miserable Variable Aug 30 '12 at 1:48
"Either" is suggestive of 'exclusive or', but only that. I certainly wouldn't say it does anything as strong as "implies". – Chan-Ho Suh Aug 30 '12 at 2:04
Edited to "suggests." – Kelly Tessena Keck Aug 30 '12 at 13:15

X or Y must be set but not both

is short and unambiguous.

-
Careful. The meaning doesn't match the original. The question refers to two distinct properties (with no mention of their values), not a single binary property. – user113215 Aug 30 '12 at 14:13
I hold that it isn't the same at all. Compare "Your dessert may be ice cream or cake" (enumerating possible values for one property) with "You may have either an appetizer or a dessert" (separate properties that are mutually exclusive, with no mention of the possible values). – user113215 Aug 31 '12 at 1:12

Properties X and Y are mutually exclusive.

-
Careful. The meaning doesn't match the original. The question refers to two distinct properties (with no mention of their values), not a single binary property. – user113215 Aug 30 '12 at 14:13
You are correct, I got caught up in some other interpretations here. I have corrected it. – Jim Aug 30 '12 at 14:31

You don't want as opposed to here: A as opposed to B means A (only), not B.

There are several ways of saying what you want; one may be more graceful than another in a particular context, but any of them will work:

Either [this property] must be set, or [property X], but not both.
You must set either [this property] or [property X], but not both.
You must set exactly one of [this property] and [property X].
Set one, but not both, of [this property] and [property X].
Select one property to set: [this property] or [property X].

-
+1 this is the most complete and accurate answer. – Chan-Ho Suh Aug 30 '12 at 3:28
"Either" already means "but not both". If your audience is literate enough, use just "either"; if not, use just "but not both". – MSalters Aug 30 '12 at 8:35
@MSalters I agree with you; but the Golden Rule for Writers is a corollary of Murphy's Law: If a passage can be misunderstood, it will be. – StoneyB Aug 30 '12 at 11:38

If neither property is required, then consider phrasing it in the negative:

You may not set both [property X] and [property Y].

For clarity, also consider including the result of ignoring this requirement:

Attempting to set both properties will result in an IllegalStateException.

-or-

The most recently set property takes precedence.

-

If I understand your question correctly, "Set only one: A or B," would be clear and simple.

-