Twitter Feed: Post

Twitter Feed

@relizarov ("Roman Elizarov") wrote:

This is not a trick question, just probing your programmer's intuition. Assume that you have a property that coerces its value in the setter:

var percent: Int = 0
set(value) { field = value.coerceIn(0, 100) }

Don't run it! What should this line print?

println(--percent)