Skip to content

Update hello-print exercise to be clearer #1573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/hello/print.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ fn main() {

// This will not compile because `Structure` does not implement
// fmt::Display
println!("This struct `{}` won't print...", Structure(3));
// FIXME ^ Comment out this line.
//println!("This struct `{}` won't print...", Structure(3));
// TODO ^ Try uncommenting this line

// For Rust 1.58 and above, you can directly capture the argument from
// surrounding variable. Just like the above, this will output
Expand All @@ -88,8 +88,9 @@ Implementing the `fmt::Display` trait automatically implements the

### Activities

* Fix the two issues in the above code (see FIXME) so that it runs without
* Fix the issue in the above code (see FIXME) so that it runs without
error.
* Try uncommenting the line that attempts to format the `Structure` struct (see TODO)
* Add a `println!` macro call that prints: `Pi is roughly 3.142` by controlling
the number of decimal places shown. For the purposes of this exercise,
use `let pi = 3.141592` as an estimate for pi. (Hint: you may need to
Expand Down