title: Precondition functions in Kotlin - good practices
body: <p>Being a newbie Kotlin coder, I wonder, if there are some good practices or even language constructs for declaring pre-conditions in functions.</p>
  
  <p>In Java I have been using Guava's Preconditions checking utilities:</p>
  
  <p><a href="https://github.com/google/guava/wiki/PreconditionsExplained" rel="noreferrer">https://github.com/google/guava/wiki/PreconditionsExplained</a></p>
  
  <p>After some further investigation I came across the require function:</p>
  
  <p><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/require.html" rel="noreferrer">https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/require.html</a></p>
  
  <p>Is this what is generally used for checking preconditions on functions?</p>