Studying Rust from “The book,” The Rust Programming Language
Build and run with default Rust installation
$ cargo run
Example Output:
$ cargo run
Compiling guessing_game v0.1.0 (/Users/user/Projects/guessing_game)
Finished dev [unoptimized + debuginfo] target(s) in 0.82s
Running 'target/debug/guessing_game'
Guess the number!
Please input your guess.
50
You guessed: 50
Too big!
Please input your guess.
25
You guessed: 25
Too big!
Please input your guess.
12
You guessed: 12
Too big!
Please input your guess.
6
You guessed: 6
Too small!
Please input your guess.
8
You guessed: 8
Too big!
Please input your guess.
7
You guessed: 7
You win!
After that, you may run the executable located at target folder.
$ ./target/debug/guessing_game
Note: To build release:
$ cargo build --release
$ ./target/release/guessing_game