How i can check var's when modify them? ```class I...
# getting-started
e
How i can check var's when modify them?
Copy code
class ItemStack(val id: Int, var quantity: Int, var metadata : Int = 0) {

    init {
        if(id <= 0) throw IllegalStateException("Id $id, but expected positive")
        if(quantity <= 0) throw IllegalStateException("Quantity $quantity, but expected positive")
        if(metadata < 0) throw IllegalStateException("Metadata $metadata, but expected nonnegative")
    }

}