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 ba2213b

Browse files
struct1.rs completed
1 parent 55ad25b commit ba2213b

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
509 KB
Binary file not shown.

‎5. Compound Data Types/5.5 Structs/structs1.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,19 @@ fn main() {
1818
println!("Success!");
1919
}
2020
*/
21+
22+
struct Person {
23+
name: String,
24+
age: u8,
25+
hobby: String,
26+
}
27+
fn main() {
28+
let age: u8 = 30; // defining datatype
29+
let p: Person = Person {
30+
name: String::from("sunface"),
31+
age,
32+
hobby: String::from("Movies"),
33+
};
34+
35+
println!("Success!");
36+
}

0 commit comments

Comments
(0)

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