Constant: is at the time of initialization (try to define the value will not be assigned to error) to give an accurate value, can be used in many places directly, with the Let keyword life
Variables: This is needless to say, you can change the amount in the next second, with the VAR keyword declaration
Let width = 94 constant declaration, the data type can not be declared in swift, Swift infers the type itself, or it can declare its own label type, add colon after the name, plus the type to be declared, such as allow explictfloat:float = 4.0 (in order to declare the specification, preferably a space after the colon)
There is no implicit conversion in swift, to convert a data type to another data type, you have to do an explicit conversion, otherwise you will get an error, such as you can remove the following string () Try reading the newspaper what error
Let label = "the width is"
Let width = 94
Let Widthlabel = label + String (width)
There is also an easier way to convert a value to a string, that is, to write a value in parentheses, and then precede the parentheses with a backslash (backslash), for example
Let apples = 5
Let applesummary = "I has \ (apples) apples"
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The constants and variables of Swift learning