overflows专题

Swift Compiler Error Integer literal overflows when stored into 'UInt8'

Swift 报错: Swift Compiler Error Integer literal overflows when stored into 'UInt8' 错误代码:         let a: UInt8 = 1_000 UInt8的取值范围是0~255,当复制超过其存储范围时,就会报错UInt8存不了这么大的数.所以在平常操作中,要注意常量和变量的取值范围.