Skip to content

Glossary: Kotlin Basics

require

Also written: require()

Raises an IllegalArgumentException with your message if a condition is false. Use it to keep bad data out, such as a negative quantity.

Where the book teaches it

Related terms

checkexceptioninit block