Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun diameter(shape: Shape): Double = when (shape) {
- is Rectangle -> Math.sqrt(shape.x * shape.x + shape.y * shape.y)
- is Circle -> 2 * shape.radius
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement