- 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.
推薦閱讀
- GitHub Essentials
- Google Visualization API Essentials
- 輕松學(xué)大數(shù)據(jù)挖掘:算法、場(chǎng)景與數(shù)據(jù)產(chǎn)品
- 從0到1:數(shù)據(jù)分析師養(yǎng)成寶典
- MongoDB管理與開(kāi)發(fā)精要
- 商業(yè)分析思維與實(shí)踐:用數(shù)據(jù)分析解決商業(yè)問(wèn)題
- 區(qū)塊鏈通俗讀本
- 白話大數(shù)據(jù)與機(jī)器學(xué)習(xí)
- Visual Studio 2013 and .NET 4.5 Expert Cookbook
- 改變未來(lái)的九大算法
- 數(shù)據(jù)挖掘競(jìng)賽實(shí)戰(zhàn):方法與案例
- Access 2010數(shù)據(jù)庫(kù)程序設(shè)計(jì)實(shí)踐教程
- Filecoin原理與實(shí)現(xiàn)
- Google Cloud Platform for Architects
- 深入理解Flink:實(shí)時(shí)大數(shù)據(jù)處理實(shí)踐