swift-book
swift-book copied to clipboard
Fallback Value vs Default Value
Location
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/thebasics#Providing-a-Fallback-Value https://docs.swift.org/swift-book/documentation/the-swift-programming-language/basicoperators#Nil-Coalescing-Operator
Description
With respect to the right operand of the nil-coalescing operator, it is referred to as default value in three subsections and as the fallback value in two subsections.
In the Control Flow subsection of the A Swift Tour section, the term default value is used. In the nil subsection of the The Basics section, the term fallback value is used. In the Providing a Fallback Value subsection of the The Basics section, both terms are used, but not connected. In the Nil-Coalescing Operator subsection of the Basic Operators section, the term default value is used.
Either one term should be used exclusively or a connection between the terms should be made.
Correction
In the Providing a Fallback Value subsection, reword the first sentence to: Another way to handle a missing value is to supply a default value, termed a fallback value, using the nil-coalescing operator (??). In the Nil-Coalescing Operator subsection, replace the term default value with fallback value (twice).