lainfinity.blogg.se

Kotlin internal keyword
Kotlin internal keyword




kotlin internal keyword

If empty, stop execution and throw an exception otherwise, reassign the value to a special field variable. We validated the value by checking if the value is empty. The parameter value passed to the set method represents the actual value that was assigned to the property by users-you can change the parameter name if you wish, but value is much preferred. You can see we defined our own setter method set(value) for the title right below the property definition-note that you can't modify this set() method signature because this is what the compiler expects as a custom property setter function.

kotlin internal keyword

Throw IllegalArgumentException ( "Title must not be empty" )






Kotlin internal keyword