Contracts

In the base Kotlin package, you can find several functions that can be used for runtime checking of data. They can be used for defining preconditions in functions. If you ever coded in Java then you probably wrote a not null precondition, with checking that an argument passed to a method is not null. The following methods are available, check, checkNotNull, require, requireNotNull and error. Let’s show some examples of them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.45.5