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

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.

主站蜘蛛池模板: 山阴县| 鹤庆县| 秭归县| 额济纳旗| 绥中县| 左权县| 潼关县| 黄冈市| 北安市| 肇东市| 昭通市| 霍山县| 乌什县| 巴南区| 辉南县| 尼玛县| 瓦房店市| 石渠县| 喀喇沁旗| 石柱| 沂水县| 黔南| 上饶县| 宜都市| 兴业县| 琼中| 陵川县| 奎屯市| 石景山区| 河源市| 唐河县| 察隅县| 永德县| 长沙县| 乐山市| 九江市| 濮阳县| 汝阳县| 鱼台县| 襄城县| 荣成市|