# SE-0225: Adding isEven, isOdd, isMultiple to BinaryInteger

**URL:** <https://forums.swift.org/t/se-0225-adding-iseven-isodd-ismultiple-to-binaryinteger/15382>\
**Category:** Proposal Reviews\
**Created:** [August 20, 2018, 6:52pm UTC](https://forums.swift.org/t/se-0225-adding-iseven-isodd-ismultiple-to-binaryinteger/15382 "2018-08-20T18:52:38Z")\
**Posts on this page:** 1\
**Showing post:** 48

<div class="post-metadata">

**Author:** ![davedelong](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/davedelong/32/38708_2.png) [@davedelong](https://forums.swift.org/u/davedelong)\
**Post date:** [August 22, 2018, 2:31pm UTC](https://forums.swift.org/t/se-0225-adding-iseven-isodd-ismultiple-to-binaryinteger/15382/48 "2018-08-22T14:31:01Z")

</div>

- What is your evaluation of the proposal?

+1. These should absolutely be added.

- Is the problem being addressed significant enough to warrant a change to Swift?

Yes. Improving readability and code clarity should be a fundamental goal of language improvements.

- Does this proposal fit well with the feel and direction of Swift?

Yes. I follow the Law Of @soroush , which says that if an extension meets any one of the following four criteria, it deserves to exist:

1. Does it increase expressivity?
2. Does it decrease noise?
3. Does it include a performance optimization?
4. Does it belong on every instance of the type?

This proposal meets all _four_ of these criteria, so I believe it belongs in the standard library.

It increases expressivity because using `isEven` or `isOdd` or `isMultiple()` is far _clearer_ in code than a modulo expression. It's easier to understand what the code is doing, and what the expectation of the result should be.

It decreases noise, because it removes the use of not-commonly-used operator (`%`) which is harder for new programmers to understand. (Because, among other reasons, you cannot option-click an operator in Xcode to get documentation on it)

It includes a performance optimization, because of the difficulty in implementing a _correct_ "is odd" function – this is a burden your typical developer should not have to care about.

Finally, this belongs on all integers, because all integers can answer the question "is this number even", "is this number odd", or "is this number a multiple of the provided number".

Because of this, these extensions should absolutely exist, and the resulting huge gains in code expressivity mean they should have a place in the standard library.

- How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

I have been following the thread.

---

_[View the full topic](https://forums.swift.org/t/se-0225-adding-iseven-isodd-ismultiple-to-binaryinteger/15382)._
