Hello, I'm very new to Kotlin and was wondering if...
# getting-started
n
Hello, I'm very new to Kotlin and was wondering if it was possible to make a variable to only fit its string value on a restricted interval. I want to make the user input an hour and if the value of int goes above 24 it displays "Number not valid". Any inputs on this?
t
I believe you need to override set property https://kotlinlang.org/docs/properties.html#getters-and-setters
👍 1
g
You could also look into contracts if you want the compiler to force you to check that
👍 1