Kotlin control flow Core principle Make the classified value obvious, keep branch-local predicates on their branch, and let the compiler prove closed-domain coverage. Procedure 1. Name the value being classified. If every branch tests it, use ; otherwise keep a subjectless or chain. 2. Choose the branch shape: | Code shape | Prefer | |---|---| | One classified value | | | Unrelated boolean conditions | Subjectless or / | | Primary case plus a branch-local predicate | Guard condition | | Invalid input before the main path | Early return, , or | | Closed value-returning domain | Exhaustive expr…