亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么我使用的toInt方法會給提示出錯

https://img1.sycdn.imooc.com//5d3d0d3100017b3e24200126.jpg

這么會有問題的,具體是什么情況

正在回答

3 回答

let userInput = "18"

var age = Int(userInput)


if age != nil {

? ? print("Your age is + \(String(describing: age!))")

} else {

? ? print("invalid userInput")

}


0 回復 有任何疑惑可以回復我~

let userInput = "18"

var age = Int(userInput)


if age != nil {

? ? print("Your age is + \(String(describing: age!))")

} else if age == nil {

? ? print("invalid userInput")

}



0 回復 有任何疑惑可以回復我~

你的xcode,swift是啥版本的?報錯信息是說沒有 toInt這個成員(memeber),估計應該是因為你的swift版本低導致的

0 回復 有任何疑惑可以回復我~
#1

慕沐8480496 提問者

我的Xcode是最新的,swift 使用的是5.01的。
2019-08-12 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

為什么我使用的toInt方法會給提示出錯

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號