Kotlin - Advanced Tricks
summary
Shows advanced Kotlin idioms and patterns: using repeat instead of loops, also/takeIf/takeUnless for ordered side effects and conditional chaining, overloading operator fun invoke to make factories/renderers callable for DSL-style code, building HTTP endpoints as block-style actions with receiver lambdas, using the Nothing type to model terminal states for compile-time safety, and delegating function-like behavior to objects. Examples are runnable snippets demonstrating each technique.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 1:04Repeat function
- 2:07Also function
- 4:58TakeIf and takeUnless
- 7:50Deep links with invoke
- 11:51DSLs with invoke
- 21:58Companion objects
- 28:53Nothing type
- 31:46Guard with Nothing
- 35:22Nothing in binary trees
- 37:08Result with Nothing
- 38:32Interface compliance
- 40:37Literal functions
- 43:53Conclusion & Q&A








