Back to questions
JuniorTheoryOccasional
What does the program print?
fn main() {
let (a, _, c) = (1, "two", 3.0);
println!("{} {}", a + 1, c);
}2 3
- Expecting
3.0:{}prints anf64with a zero fraction as a whole number; only{:?}keeps the.0. - Expecting
_not to count in thelet: it fills the second place, socgets the third element.
- How would you read the second element without destructuring the tuple?
- What would
{:?}print forcin this program, and why?