Skip to content

Instantly share code, notes, and snippets.

@catamorphism
Created September 18, 2012 18:13
Show Gist options
  • Select an option

  • Save catamorphism/3744765 to your computer and use it in GitHub Desktop.

Select an option

Save catamorphism/3744765 to your computer and use it in GitHub Desktop.
enum Color { Red, Green, Blue }
fn drawCircleWithColor(color: Option<Color>, radius: double) {
let color = match color {
Some(c) => c,
None => Red
};
// ...
}
fn drawCircle(radius: double) {
drawCircleWithColor(None, radius);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment