# Even and Odd Integers

**URL:** <https://forums.swift.org/t/even-and-odd-integers/11774>\
**Category:** Pitches\
**Created:** [April 8, 2018, 8:07pm UTC](https://forums.swift.org/t/even-and-odd-integers/11774 "2018-04-08T20:07:38Z")\
**Posts on this page:** 1\
**Showing post:** 58

<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:** [July 27, 2018, 6:02pm UTC](https://forums.swift.org/t/even-and-odd-integers/11774/58 "2018-07-27T18:02:24Z")

</div>

`<bikeshed>`  
It should be `isEvenlyDivisible(by:)`, because 10 is divisible by 3. Just not evenly divisible.  
`</bikeshed>`

Edited to add:

I'd be in favor of adding `isOdd` and `isEven` because:

1️⃣ they increase readability and therefore expressivity

2️⃣ It makes mapping or ternary logic simpler which increases readability and therefore expressivity

```
view.backgroundColor = row.isEven ? .white : .lightGray

```

vs

```
view.backgroundColor = (row % 2 == 0) ? .white : .lightGray // extra parentheses yuck

```

---

_[View the full topic](https://forums.swift.org/t/even-and-odd-integers/11774)._
