2024-03-20 09:31:14 +00:00
|
|
|
# Dust
|
|
|
|
|
|
|
|
High-level programming language with effortless concurrency, automatic memory management, type
|
|
|
|
safety and advanced error handling.
|
|
|
|
|
2024-05-18 15:59:39 +00:00
|
|
|
```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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|