Last active
August 8, 2019 19:16
-
-
Save fboeller/05a0d39a2be8a814d06a452a792a761c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun perimeter(shape: Shape): Double = when (shape) { | |
is Rectangle -> (shape.x + shape.y) * 2 | |
is Circle -> 2 * PI * shape.radius | |
is Parallelogram -> (shape.base + shape.side) * 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment