- Swift Functional Programming(Second Edition)
- Dr. Fatih Nayebi
- 78字
- 2021-07-02 23:54:23
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.
推薦閱讀
- 同步:秩序如何從混沌中涌現(xiàn)
- GitHub Essentials
- Hadoop與大數(shù)據(jù)挖掘(第2版)
- Oracle高性能自動(dòng)化運(yùn)維
- Spark核心技術(shù)與高級(jí)應(yīng)用
- 城市計(jì)算
- Python金融數(shù)據(jù)分析(原書第2版)
- ZeroMQ
- 云原生數(shù)據(jù)中臺(tái):架構(gòu)、方法論與實(shí)踐
- 科研統(tǒng)計(jì)思維與方法:SPSS實(shí)戰(zhàn)
- INSTANT Apple iBooks How-to
- 一本書講透Elasticsearch:原理、進(jìn)階與工程實(shí)踐
- 商業(yè)智能工具應(yīng)用與數(shù)據(jù)可視化
- 數(shù)據(jù)分析思維:產(chǎn)品經(jīng)理的成長筆記
- 區(qū)塊鏈應(yīng)用開發(fā)指南:業(yè)務(wù)場景剖析與實(shí)戰(zhàn)