Let secondsystem:Int = 0b10001
Let eightsystem:Int = 0o21
Let tensystem:Int =
Let sixthsystem:Int = 0x11
SUMMARY:1.U need insert a "Enter" behind equal symbol
Let num_a:Float = 1
Let num_b:Int = 1
Let A:Int = 3
Let B:Double = 0.1415926
Let pi:double = double(a) + b
summary:2.it need change-number ' s type in the same, in order to getting the result
Let bignum_a:Float = Ten/2.5
Let bignum_a2:Int = Ten/3
Let bignum_b:float = float(Int(1.2)) *10.1
Let bignum_c:int = int(3.99)
summary:3.it need change-number ' s type in the same, in order to getting the result
4.forcing number type need add type symbol in the front of number
Let jy = " Love Cooking "
Let address = ". Jianggan,hangzhou City,zhejiang Province,china "
JY + address
Let params = (isloginsuccess:true, Name:"Tommy", Age:)
Let (isloginsuccess,name,age) = params
Let islginsuccess = params. 0
Let whats = params. Name
Let whatsage = params. 2
Let (IsTrue,_,_) = params
If (isTrue)
{
Print("Login success!" )
}
Let Personarray = ("A","B","C","D")
Let Aperson = personarray. 0
Let Bperson = personarray. 1
Summary:5. Tuples
var value_a:Int
Value_a = 1
var imoptionalvariable:Int?
Summary:it ' s equal to nil when the optionalvariable is empty
Imoptionalvariable =
Let name = "Tommy"
var age = Int(name)
If age! = Nil
{
Print("It ' s not empty")
}
else {
Print("It ' s empty!" )
}
Let userage = " "
var currentage = Int(userage)
Let currentnewage = Int(userage)
Summary:string toint use Method:int (String)
If currentage! = nil
{
Print("Age: \(currentage)")
Print("He is" + String(currentage!))
}
If userage . IsEmpty
{
Print("Age: \(userage)")
}Else {
Print("Age:\(userage)")
}
Let Stringa:String? = "optional_string"
Let string2 = "_/stringa"
var stringb = Stringa! + string2
Stringa
Stringa!
Day1 (Let and Var)/(String,int,float,double)/(Tuples,contains:array,dictionary)