We have a function that calculates the taxes of a purchase: fun getTaxes(amount: Double): Double, but we want to make sure that the cost is greater than zero; if it is not, we will throw an exception with the message: "Amount must be greater than zero".
What function should we use to perform this check in our code?
Require, check, and assert
Checking the price
Report a typo
Enter a short text
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.