Prerequisites in Kotlin - Good Practices

As a newcomer to the Kotlin coder, I wonder if there are any good practices or even language constructs for declaring preconditions in functions.

In Java, I used the Guava Preconditions validation utilities:

https://github.com/google/guava/wiki/PreconditionsExplained

After some further research, I came across the require function:

https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/require.html

Is this what is commonly used to test prerequisites for functions?

+4
source share
3 answers

, "require" , , - , , "require" , "require" . , () "" .

( "", , kotlin, , - , , - , , , " - /. , .)

0

Source: https://habr.com/ru/post/1681563/


All Articles