English
Topic 3. Functions: default parameters, named arguments, extension functions; strings and string templates
Goal: learn to extract functions with explicit contracts, use default and named arguments, create extensions, and test text transformations.
Lecture contents
- Function declarations and kinds — Declaration and calls · Unit, Nothing, and preconditions · Top-level and local functions
- Parameters and arguments — Default parameters and named arguments · Vararg and array spreading
- Recursion, infix functions, and extensions — Recursion and the call stack · Infix functions · Extension functions
- Strings and string templates — String immutability and characters · Templates and multiline literals · Searching, slicing, and formatting · StringBuilder and incremental text construction
- Regular expressions and testing — Regex: full matching and searching · Testing functions and text contracts