W3cubDocs

/Kotlin

contract

Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)
@ExperimentalContracts inline fun contract(
    builder: ContractBuilder.() -> Unit)

Specifies the contract of a function.

The contract description must be at the beginning of a function and have at least one effect.

Only the top-level functions can have a contract for now.

Parameters

builder - the lambda where the contract of a function is described with the help of the ContractBuilder members.

© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.contracts/contract.html