Skip to content

Commit

Permalink
Update task.md (#199)
Browse files Browse the repository at this point in the history
language checked
  • Loading branch information
stephen-hero authored Dec 20, 2023
1 parent 8f56b43 commit 1d714ca
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Hangman/isCompleteFunction/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ It's time to practice! Let's start with a simple function.
### Task

Implement the `isComplete` function, which accepts two string arguments - `secret` and `currentGuess`,
and checks if the game is complete. The game is complete only if `secret` and `currentGuess` equal.
and checks if the game is complete. The game is complete only if `secret` and `currentGuess` are equal.

<div class="hint" title="Click me to see the new signature of the isComplete function">

Expand All @@ -13,13 +13,13 @@ fun isComplete(secret: String, currentGuess: String): Boolean
```
</div>

**Note**, that `currentGuess` contains spaces between letters.
So, it's not enough just to compare `secret` and `currentGuess`.
You need to remove all spaces from `currentGuess` first.
**Note** that `currentGuess` contains spaces between letters.
Therefore, it's not enough to merely compare `secret` and `currentGuess`.
You'll need to remove all spaces from `currentGuess` first.

You can also use the already defined variable `separator` that stores a space:
You can also use the already defined variable `separator`, which stores a space:
```kotlin
println("It is the value from the separator variable: $separator.") // It is the value from the separator variable: .
println("This is the value from the separator variable: $separator.") // This is the value from the separator variable: .
```

If you have any difficulties, **hints will help you solve this task**.
Expand All @@ -28,7 +28,7 @@ If you have any difficulties, **hints will help you solve this task**.

### Hints

<div class="Hint" title="Click me to see examples how the isComplete function works">
<div class="Hint" title="Click me to see examples of how the isComplete function works">

Here are several examples of the _isComplete_ function's work:

Expand All @@ -37,11 +37,11 @@ Here are several examples of the _isComplete_ function's work:
- secret = "ABC", currentGuess = "A A A", result = false;
</div>

<div class="Hint" title="Click me to learn how to replace separator in the current user's guess">
<div class="Hint" title="Click me to learn how to remove the separator in the current user's guess">

The easiest way to replace `separator` in `currentGuess` is to use the built-in function [`replace`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/replace.html):
The easiest way to remove `separator` in `currentGuess` is to use the built-in function [`replace`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/replace.html):
```kotlin
println("aabbccdd".replace("a", "e")) // eebbccdd
```
In this task you can just replace `separator` with an empty string `"""`.
In this task, you can just replace `separator` with an empty string `"""`.
</div>

0 comments on commit 1d714ca

Please sign in to comment.