Kotlin puzzlers, Vol. 2
summary
Live demo of 20+ small Kotlin surprises with working code and outputs: shows that print returns Unit so weird comparisons compile, a unary minus on a numeric literal can force it into Long (minus applies after literal typing), placing an operator on a new line can turn it into a unary operator, and Kotlin 1.3 sequences are lazy so take(3) yields 0,1,2. Also demonstrates DSL scope leaks and how a @DslMarker fixes them, and that accessing a property in a base-class init prints null — all examples run and explain why.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 2:35What are Kotlin puzzlers
- 6:16Print function issue
- 8:05Int min and overflow
- 14:13Game of Life and operator precedence
- 18:27DSL markers and compiler errors
- 24:30with function and operator priorities
- 31:24Lambdas and closures in loops
- 34:22Boolean comparisons
- 37:12Delegates and destructuring
- 41:11also function and invalid code
- 47:59Open classes and cyclic dependencies
- 51:13New Kotlin 13 features
- 54:09Final puzzle and wrap-up








