Scope is the region of code in which a symbol can be referenced. It controls a binding’s lifetime and accessibility, helping code state which names belong together and where they are intended to be used. section 3.1.3 section 3.4
F# expresses scope with whitespace indentation rather than curly braces. Lines indented to the same level belong to the same body; increasing indentation creates a nested scope. Four spaces per level is a common convention, and tabs are not valid F# tokens. section 3.1.3
let greetingText = #1
let fullName = #2
let fname = "Frank" #3
let sname = "Schmidt"
$"{fname} {sname}" #4
$"Greetings, {fullName}" #5
Nested let bindings build a full name inside the scope that produces a greeting. The inner names support the result without needing to become top-level bindings. section 3.1.3
Use nested scopes to keep intermediate work close to the value that needs it:
- Bind temporary values with let, then return the final expression from the indented block. section 3.1.3
- Move a nested calculation into a separate function when it should be reused or tested independently. section 4.1.5
- After extracting a scope, pass required outer symbols as function inputs and let the compiler infer types where possible. section 4.1.5
Extracting a reusable calculation
A function that both calculates an age description and prints it ties the calculation to console output. Extract the age-description logic into a function, call it from the printing function, and the calculation can serve other outputs and unit tests. section 4.1.5




















