Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4cde9e8

Browse files
structs7.rs added
1 parent 89934ad commit 4cde9e8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
11
//We can use #[derive(Debug)] to make a struct printable.
2+
/*
3+
/ Fill the blanks to make the code work
4+
#[__]
5+
struct Rectangle {
6+
width: u32,
7+
height: u32,
8+
}
9+
10+
fn main() {
11+
let scale = 2;
12+
let rect1 = Rectangle {
13+
width: dbg!(30 * scale), // Print debug info to stderr and assign the value of `30 * scale` to `width`
14+
height: 50,
15+
};
16+
17+
dbg!(&rect1); // Print debug info to stderr
18+
19+
println!(__, rect1); // Print debug info to stdout
20+
}
21+
*/

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /