C has logical or (||), and (&&) and not (!) but doesn't have logical xor because it already exists as !=

· · Web · 1 · 0 · 1

Actually I guess this isn't quite true because && and || do the coercion into a boolean value, you'd have to do something like !x != !y to get the proper equivalent of x ^^ y

Show thread

@fraggle or (!x ^ !y) or (x ? !y : y), probably the latter being least hacky/clever

@fraggle i had to read the entire thread to stop parsing that last expression as a smiling face making some very high-context hand gestures

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!