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

Type inference

Swift provides type inference. Swift infers the type of a variable, constant, or expression automatically, so we do not need to specify the types while defining them. Let's look at the following example:

let pi = 3.14159 
var primeNumber = 691
let name = "my name"

In this example, Swift infers pi as Double, primeNumber as Int, and name as String. If we need special types such as Int64, we will need to annotate the type.

主站蜘蛛池模板: 东乌珠穆沁旗| 金坛市| 财经| 读书| 寿阳县| 五常市| 饶河县| 乌苏市| 富平县| 蒙城县| 山东| 博罗县| 宁都县| 石嘴山市| 高安市| 兴安盟| 沾益县| 唐山市| 白河县| 乌拉特中旗| 富裕县| 商丘市| 金沙县| 海伦市| 奉化市| 应用必备| 香格里拉县| 沂南县| 沧州市| 旅游| 开封县| 高清| 九台市| 梅河口市| 锦州市| 瑞安市| 丰台区| 建阳市| 巴彦淖尔市| 连江县| 无极县|