mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-26 00:00:03 +03:00
primitive_types5 solution
This commit is contained in:
parent
2a1bc53771
commit
532c9ebb30
|
@ -1,8 +1,8 @@
|
|||
// Destructure the `cat` tuple so that the println will work.
|
||||
|
||||
fn main() {
|
||||
let cat = ("Furry McFurson", 3.5);
|
||||
let /* your pattern here */ = cat;
|
||||
|
||||
println!("{} is {} years old.", name, age);
|
||||
// TODO: Destructure the `cat` tuple in one statement so that the println works.
|
||||
// let /* your pattern here */ = cat;
|
||||
|
||||
println!("{name} is {age} years old");
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ Particularly the part about destructuring (second to last example in the
|
|||
section).
|
||||
|
||||
You'll need to make a pattern to bind `name` and `age` to the appropriate parts
|
||||
of the tuple. You can do it!!"""
|
||||
of the tuple."""
|
||||
|
||||
[[exercises]]
|
||||
name = "primitive_types6"
|
||||
|
|
|
@ -1 +1,8 @@
|
|||
// Solutions will be available before the stable release. Thank you for testing the beta version 🥰
|
||||
fn main() {
|
||||
let cat = ("Furry McFurson", 3.5);
|
||||
|
||||
// Destructuring the tuple.
|
||||
let (name, age) = cat;
|
||||
|
||||
println!("{name} is {age} years old");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue