-To make a loop check over each char in a string, you can use the
`indices` property:
+To loop over each char in a string, you can use the
`indices` property:
```
for (i in "abcd".indices) { ... } // i will be 0, 1, 2, 3
```
@@ -48,10 +48,10 @@ It is the same as:
for (i in 0 until "abcd".length) { ... } // i will be 0, 1, 2, 3
```
-It's a more convenient and shorter way to represent a range of indices.
+It's a more convenient and concise way to represent a range of indices.
+
The [`removeSuffix`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/remove-suffix.html) function
helps to delete a suffix from a string:
@@ -59,23 +59,23 @@ helps to delete a suffix from a string:
println("abcdef".removeSuffix("f")) // abcde
```
-It can be helpful if you need to delete some extra separators from the end of the string.
+It may be useful if you need to delete some extra separators from the end of the string.
-
+
-To implement the `generateNewUserWord` function you can just to check for each letter from the `secret`
-if this letter equals with the `guess`.
-Ff the current `secret`'s char matches the `guess`'s char in the same position,
+To implement the `generateNewUserWord` function, you just need to check if each letter from the `secret`
+matches the `guess`.
+If the current `secret`'s char matches the `guess`'s char in the same position,
add the respective `secret`'s char to `newUserWord`; otherwise, add the `currentUserWord`'s char in the `i * 2` position,
-where `i` is the position of the current chair.
+where `i` is the position of the current char.
-**Also, don't forget to add a separator at the loop's step, since you need to generate the result with spaces:**
+**Also, don't forget to add a separator at each step of the loop, since the resulting string needs to include spaces:**
```kotlin
"${secret[i]}$separator" or "${currentUserWord[i * 2]}$separator" // CORRECT
"${secret[i]}" or "${currentUserWord[i * 2]}" // INCORRECT
```
-If you follow this algorithm, don't forget to remove an extra space from the end of the new string.
+When following this algorithm, don't forget to remove an extra space from the end of the new string.