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.


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

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.