操作符
+(_:)
返回给定的数字不变。
声明
static func + (x: Self) -> Self
返回值
给定的参数没有任何变化。
详述
在使用一元减号运算符时,您可以使用一元加号运算符 (+
) 在代码中为正数提供对称性。
let x = -21
let y = +21
// x == -21
// y == 21
可用版本
iOS 8.0+, iPadOS 8.0+, macOS 10.10+, Mac Catalyst 13.0+, tvOS 9.0+, watchOS 2.0+
相关用法
- Swift UInt8 +(_:_:)用法及代码示例
- Swift UInt8 +=(_:_:)用法及代码示例
- Swift UInt8 ~(_:)用法及代码示例
- Swift UInt8 leadingZeroBitCount用法及代码示例
- Swift UInt8 init(integerLiteral:)用法及代码示例
- Swift UInt8 ..<(_:_:)用法及代码示例
- Swift UInt8 *=(_:_:)用法及代码示例
- Swift UInt8 multipliedFullWidth(by:)用法及代码示例
- Swift UInt8 ^=(_:_:)用法及代码示例
- Swift UInt8 init(clamping:)用法及代码示例
- Swift UInt8 init(truncatingIfNeeded:)用法及代码示例
- Swift UInt8 *(_:_:)用法及代码示例
- Swift UInt8 trailingZeroBitCount用法及代码示例
- Swift UInt8 >>=(_:_:)用法及代码示例
- Swift UInt8 >>(_:_:)用法及代码示例
- Swift UInt8 |(_:_:)用法及代码示例
- Swift UInt8 nonzeroBitCount用法及代码示例
- Swift UInt8 ==(_:_:)用法及代码示例
- Swift UInt8 &-=(_:_:)用法及代码示例
- Swift UInt8 &<<(_:_:)用法及代码示例
- Swift UInt8 init(exactly:)用法及代码示例
- Swift UInt8 &=(_:_:)用法及代码示例
- Swift UInt8 <<=(_:_:)用法及代码示例
- Swift UInt8 -(_:_:)用法及代码示例
- Swift UInt8 &(_:_:)用法及代码示例
注:本文由纯净天空筛选整理自apple.com大神的英文原创作品 UInt8 +(_:)。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。