Skip to content

Commit

Permalink
refac: Use loop instead of while
Browse files Browse the repository at this point in the history
  • Loading branch information
ryym committed Aug 8, 2018
1 parent 0796090 commit d436d06
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ impl<W: Write> Game<W> {
self.screen.render_title()?;
thread::sleep(Duration::from_millis(800));

let mut next = self.play(Play::new())?;
while next != Action::Quit {
next = self.play(Play::new())?;
loop {
let next_action = self.play(Play::new())?;
if next_action == Action::Quit {
return Ok(());
}
}
Ok(())
}

fn play(&mut self, mut play: Play) -> Result<Action> {
Expand Down

0 comments on commit d436d06

Please sign in to comment.