: Playground-noun:a place where people can playimport uikitvar str = "Hello, Playground"//Constants defined with Letlet Maxlogincount = 10//variable is defined with Varvar Currentlogincount = 0currentLoginCount = 3//Define multiple variables or constants at the same time var x = ten, y =, z = 30//when defining constants, use uppercase as much as possible Let PI = 3.14159, speedoflight = 300_000//Same as 300000, underline to make it easy to distinguish how many 0//define a variable can give a specified type, such as allow mincount:int = 10//declaration This is an integer constant V Ar name:string = "Rinpe Chan"//Declare this is a string variable//But Swift automatically recognizes the type//variable name based on the assigned value not only in English, but also in Chinese and emoticons let? = "Bull Bull" var hello = "Hello, world" Hello = "world, hello"//output print (??) Print (hello) print ("Current login: \ (currentlogincount)") print ("π equals \ (pi)")
SWIFT-02-Constants and variables