Local functions are declared with fun keyword inside another function, followed by parentheses and body.
Step 2: Check each option
fun outer() { fun inner() { println("Hi") } inner() } uses correct syntax: fun inner() { ... } inside outer(). fun outer() { fun inner: () -> Unit = { println("Hi") } inner() } uses lambda syntax incorrectly. fun outer() { val inner = fun() { println("Hi") } inner() } uses anonymous function assigned to val, which is valid but not a local function declaration. fun outer() { def inner() { println("Hi") } inner() } uses def which is invalid in Kotlin.
Final Answer:
fun outer() { fun inner() { println("Hi") } inner() } -> Option B
Quick Check:
Local function syntax = fun inside fun [OK]
Quick Trick:Local functions use 'fun' keyword inside another function [OK]
Common Mistakes:
MISTAKES
Using def instead of fun
Confusing lambdas with local functions
Assigning anonymous functions to variables instead of declaring local functions
Master "Functions" in Kotlin
9 interactive learning modes - each teaches the same concept differently