Skip to content

Instantly share code, notes, and snippets.

@fboeller
Created August 7, 2019 19:27
Show Gist options
  • Save fboeller/e8f1fb13f98d21c918d94efc40e23895 to your computer and use it in GitHub Desktop.
Save fboeller/e8f1fb13f98d21c918d94efc40e23895 to your computer and use it in GitHub Desktop.
fun area(shape: Shape): Double = when (shape) {
is Rectangle -> shape.x * shape.y
is Circle -> PI * shape.radius * shape.radius
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment