Clean up example
This commit is contained in:
parent
70f55c85f4
commit
109c3f033c
21
README.md
21
README.md
@ -3,3 +3,24 @@
|
||||
High-level programming language with effortless concurrency, automatic memory management, type
|
||||
safety and advanced error handling.
|
||||
|
||||
```dust
|
||||
io.write_line("Guess the number.")
|
||||
|
||||
secret_number = random.range(0..100)
|
||||
|
||||
loop {
|
||||
io.write_line("Input your guess.")
|
||||
|
||||
input = io.read_line()
|
||||
guess = int.parse(input)
|
||||
|
||||
if guess < secret_number {
|
||||
io.write_line("Too low!")
|
||||
} else if guess > secret_number {
|
||||
io.write_line("Too high!")
|
||||
} else {
|
||||
io.write_line("You win!")
|
||||
break
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -5,8 +5,8 @@ secret_number = int.random_range(0..100)
|
||||
loop {
|
||||
io.write_line("Input your guess.")
|
||||
|
||||
input = io.read_line() ? io.write_line("Failed to read input.")
|
||||
guess = int.parse(input) ? io.write_line("Failed to parse input.")
|
||||
input = io.read_line()
|
||||
guess = int.parse(input)
|
||||
|
||||
if guess < secret_number {
|
||||
io.write_line("Too low!")
|
||||
|
Loading…
Reference in New Issue
Block a user