Dear Erica: What’s iff?

Dear Erica,

I’ve been enjoying your blog for a while now, and I’ve got a Swift question that’s been nagging me and have had no luck with Google, so I was hoping you might be able to help.
What is ‘iff’? At first I thought it was just a typo for ‘if’, but I searched and there’s 184 uses of it in the Swift code documentation. It seems to be used when ‘if’ would be appropriate, but is it really possible it was mis-spelled THAT many times?

Hi Rob,

You see this pop up in the standard library a lot, for example:

/// Return `false` iff `t0` is identical to `t1`; i.e. if they are both
/// `nil` or they both represent the same type.

iff means “If and only if”. Here’s a Wikipedia write-up about this.

In logic and related fields such as mathematics and philosophy, if and only if (shortened iff) is a biconditional logical connective between statements…In that it is biconditional, the connective can be likened to the standard material conditional (“only if”, equal to “if … then”) combined with its reverse (“if”); hence the name. The result is that the truth of either one of the connected statements requires the truth of the other (i.e. either both statements are true, or both are false).


– E

One Comment

  • Answered my question, Thanks!