Skip to content

Commit 7da5b73

Browse files
committed
Improve the activity instructions in print_display
1 parent 59a6927 commit 7da5b73

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/hello/print/print_display.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,30 @@ guide to add a `Complex` struct to the example. When printed in the same
111111
way, the output should be:
112112

113113
```txt
114-
Display: 3.3 + 7.2i
114+
Display: 3.3 +7.2i
115115
Debug: Complex { real: 3.3, imag: 7.2 }
116+
117+
Display: 4.7 -2.3i
118+
Debug: Complex { real: 4.7, imag: -2.3 }
116119
```
117120

121+
Bonus: Add a space before the `+`/`-` signs.
122+
123+
Hints in case you get stuck:
124+
125+
- Check the documentation for [`Sign/#/0`][fmt_sign0] in `std::fmt`.
126+
- Bonus: Check [`if`-`else`][if_else] branching and the [`abs`][f64_abs] function.
127+
118128
### See also:
119129

120130
[`derive`][derive], [`std::fmt`][fmt], [`macros`][macros], [`struct`][structs],
121131
[`trait`][traits], and [`use`][use]
122132

123133
[derive]: ../../trait/derive.md
134+
[f64_abs]: https://doc.rust-lang.org/std/primitive.f64.html#method.abs
124135
[fmt]: https://doc.rust-lang.org/std/fmt/
136+
[fmt_sign0]: https://doc.rust-lang.org/std/fmt/#sign0
137+
[if_else]: ../../flow_control/if_else.md
125138
[macros]: ../../macros.md
126139
[structs]: ../../custom_types/structs.md
127140
[traits]: https://doc.rust-lang.org/std/fmt/#formatting-traits

0 commit comments

Comments
 (0)