// *** before: ***
func doubledOld(_ value: Int) -> Int {
return value * 2
}
struct RectangleOld {
var width = 2.0
var height = 3.0
var area: Double { return width * height }
}
// *** in version 5.1: ***
func doubled(_ value: Int) -> Int { value * 2 }
struct Rectangle {
var width = 2.0
var height = 3.0
var area: Double { width * height }
}
extension Array {
var second: Element? { count > 1 ? self[1] : nil }
}
// a closure has behaved this way since the very first Swift; now a function,
// a property and a subscript follow the same rule