1
0
dust/README.md

30 lines
617 B
Markdown
Raw Normal View History

# Dust
High-level programming language with effortless concurrency, automatic memory management, type
2024-07-15 20:42:49 +00:00
safety and familiar syntax.
2024-05-18 15:59:39 +00:00
```dust
io.write_line("Guess the number.")
2024-07-28 16:52:07 +00:00
secret_number = random.in_range(0..100)
2024-05-18 15:59:39 +00:00
loop {
io.write_line("Input your guess.")
2024-07-28 16:52:07 +00:00
input = io.read_line().expect("Failed to read line.")
guess = match input.trim().parse() {
Ok(value) => value,
Err(_) => continue,
}
2024-05-18 15:59:39 +00:00
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
}
}
```