【发布时间】:2014-12-15 22:22:07
【问题描述】:
我真的不知道如何在 Swift 中声明我的变量,我有四个选择:
var value = 0.0 // I know this one declares value as a Double with the number 0.0
var value: Float = 0.0 // This one declares value as a Float with the number 0.0
var value: Float? // I really don't get the difference between this
var value: Float! // and this, I just know that both of them are used to declare a variable without a value, am I right ?
我只想声明一个浮点数而不赋予一个值,最好的方法是什么?
【问题讨论】:
-
所有这些变量都在 SKScene 类中声明,所以我猜没有局部变量?没有在这个类的函数中,而是在类的开头,在函数声明之前。
标签: variables swift declaration