1
0

Clean up example

This commit is contained in:
Jeff 2024-05-18 11:59:39 -04:00
parent 70f55c85f4
commit 109c3f033c
2 changed files with 23 additions and 2 deletions

View File

@ -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
}
}
```

View File

@ -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!")