---
title: "appendInterpolation(_:default:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/defaultstringinterpolation/appendinterpolation(_:default:)-ue3g"
---

# appendInterpolation(_:default:)

Interpolates the given optional value’s textual representation, or the specified default string, into the string literal being created.

## Declaration

```swift
mutating func appendInterpolation<T>(_ value: T?, default: String) where T : CustomStringConvertible, T : TextOutputStreamable
```

## Parameters

- `value`: The value to include in a string interpolation, if non-nil.
- `default`: The string to include if value is nil.

## Discussion

Discussion You don’t need to call this method directly. It’s used by the compiler when interpreting string interpolations where you provide a default parameter. For example, the following code implicitly calls this method, using the value of the default parameter when value is nil: var age: Int? = 48 print("Your age is \(age, default: "unknown")") // Prints: Your age is 48 age = nil print("Your age is \(age, default: "unknown")") // Prints: Your age is unknown
