Squint
1
Please show me how to convert this 'if' snippet into a match statement:
let mut rotation: f64 = 0.0;
while let Some(event) = window.next() {
if let Some(args) = event.update_args() {
rotation += 3.0 * args.dt;
};
}
This if let
expression:
if let Some(args) = event.update_args() {
rotation += 3.0 * args.dt;
}
is equivalent to this match
expression:
match event.update_args() {
Some(args) => rotation += 3.0 * args.dt,
None => {}
}
system
Closed
4
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.