Skip to content

Commit 4d34f2b

Browse files
committed
Consistency
1 parent 314cb40 commit 4d34f2b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

_posts/2024-06-03-conditional-to-calculation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fun String.isValidCardNumber(): Boolean =
126126

127127
The second conditional sums individual digits.
128128
Given the behaviour of Kotlin's integer arithmetic operators, the branching is unnecessary.
129-
If the intermediate value, `it`, is less than ten, then `it/10` would be zero, and `it % 10` would be equal to `it`, meaning we can replace the entire when expression with `it / 10 + it % 10`, leaving the function as:
129+
If the intermediate value, `it`, is less than ten, then `it / 10` would be zero, and `it % 10` would be equal to `it`, meaning we can replace the entire when expression with `it / 10 + it % 10`, leaving the function as:
130130

131131
```kotlin
132132
fun String.isValidCardNumber(): Boolean =

0 commit comments

Comments
 (0)