Lesson 3 of 15
String Interpolation
String Interpolation
F#'s $"..." strings let you embed any expression with {expr}:
let name = "Alice"
let age = 30
printfn $"Hello, {name}! You are {age} years old."
// Hello, Alice! You are 30 years old.
You can embed arbitrary expressions:
let a = 3
let b = 4
printfn $"{a} + {b} = {a + b}"
// 3 + 4 = 7
Your Task
Write a function greet that takes a name and age and returns the string "Hello, <name>! You are <age> years old." using string interpolation.
JS Transpiler loading...
Loading...
Click "Run" to execute your code.