Skip to content

Commit

Permalink
Magic Number
Browse files Browse the repository at this point in the history
### What's done:
Fixed after review
  • Loading branch information
kentr0w committed Mar 22, 2021
1 parent b119860 commit f290802
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions info/guide/guide-chapter-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -824,19 +824,17 @@ Prefer defining constants with clear names describing what the magic number mean
**Valid example**:
```kotlin
class Person() {

fun isAdult(age: Int): Boolean = age >= majority

companion object {
const val majority = 18
private const val majority = 18
}
}
```
**InValid example**:
**Invalid example**:
```kotlin
class Person() {
val oldAge = 65
fun isAdult(age: Int): Boolean = age >= 18 && age <= oldAge
fun isAdult(age: Int): Boolean = age >= 18
}
```

Expand Down

0 comments on commit f290802

Please sign in to comment.