mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-01-11 00:00:04 +03:00
Compare commits
2 commits
5bf8d1fa1b
...
532c9ebb30
Author | SHA1 | Date | |
---|---|---|---|
532c9ebb30 | |||
2a1bc53771 |
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -516,7 +516,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
"redox_syscall 0.5.1",
|
"redox_syscall 0.5.2",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.52.5",
|
||||||
]
|
]
|
||||||
|
@ -606,9 +606,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.5.1"
|
version = "0.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e"
|
checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Destructure the `cat` tuple so that the println will work.
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let cat = ("Furry McFurson", 3.5);
|
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).
|
section).
|
||||||
|
|
||||||
You'll need to make a pattern to bind `name` and `age` to the appropriate parts
|
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]]
|
[[exercises]]
|
||||||
name = "primitive_types6"
|
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