Computer scienceProgramming languagesKotlinObject-oriented programmingSpecial constructions / Special classes

Object declarations

Library

Report a typo

In this task, you will create a simple equivalent of the Math library with one function for calculating modules.

You need to add two abs functions in the Math singleton. One of these functions should receive an Int value, while the other works with Double. These functions must return the absolute value of the obtained variable.

Let's create your own library!

Tip: Note that the absolute value of 0 is 0.

Write a program in Kotlin
object Math {
//TODO
}
___

Create a free account to access the full topic