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

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.

主站蜘蛛池模板: 新龙县| 上饶县| 平邑县| 响水县| 百色市| 台江县| 湾仔区| 德清县| 麻城市| 石门县| 惠东县| 胶州市| 南康市| 闽侯县| 天长市| 石城县| 房山区| 永兴县| 景洪市| 新乡县| 葫芦岛市| 临海市| 葫芦岛市| 武定县| 襄垣县| 雷波县| 六安市| 新民市| 甘孜县| 宜阳县| 昌吉市| 潢川县| 普格县| 北宁市| 肃南| 明光市| 黄平县| 紫云| 德惠市| 平湖市| 胶南市|