官术网_书友最值得收藏!

Swift basic types

Swift comes with a number of basic types that are at the root of all of your programs. All of your programs leverage these basic types, one way or another. Let's take some time to revisit these types and their main features, along with some hidden gems.

We can organize all of the Swift's basic types into the following categories:

  • Logical types: Bool
  • Numeric types: Int, Double, and Float, among others
  • Range types: Range and ClosedRange
  • Errors: Error protocol
  • Optionals: Optional enum

I don't believe it's necessary to introduce the Bool, Int, Double, and Float types, as they are all very common in all languages. Perhaps their most interesting feature is that they are defined as structs, and not primitive types, like in Java.

主站蜘蛛池模板: 深泽县| 高阳县| 启东市| 东乌| 阜城县| 许昌市| 西平县| 长岭县| 通州区| 白河县| 潼关县| 镇平县| 响水县| 准格尔旗| 德化县| 肥西县| 石狮市| 肃宁县| 五寨县| 沂源县| 罗江县| 哈密市| 舒城县| 乌兰浩特市| 浮梁县| 桃园市| 逊克县| 东平县| 页游| 双流县| 盐城市| 远安县| 仙桃市| 彭山县| 革吉县| 新源县| 辉县市| 南漳县| 舞钢市| 丰顺县| 曲沃县|