Closed
Description
Reading http://static.rust-lang.org/doc/master/tutorial.html#pattern-matching, my partner copied the example code:
match my_number {
0 => { println!("zero") }
_ => { println!("something else") }
}
into her program, but then was unsure what to do, possibly because she thought that the example code above would define a variable named "my_number". I suggested to her that the tutorial could instead suggest:
fn f(my_number: int) -> void {
match my_number {
0 => { println!("zero") }
_ => { println!("something else") }
}
}
and that made sense to her.
Metadata
Metadata
Assignees
Labels
No labels