First, let's talk a little bit about the swift language. It is very easy for a person who has been writing JavaScript and Java code all the year round. As someone said, everyone has weaknesses and advantages. So far, I have only a preliminary understanding of this language and these two words have spread. Maybe, this is the case for weak languages.
I. Basic Knowledge
1. Basic Type
Integer: int
Float, double
Character Type: String
Boolean: bool
Set Type: array, Dictionary
PS: the first letter of the basic type must be capitalized, and the basic type cannot be directly defined (for example, int A = 10 as in Java; it should be var A: Int = 10 ;)
VaR AAA: Int = 100; var BBB: bool = true; var CCC: Double = 233.0; var DDD: Float = 333.4; var EEE: String = "33333"; let fff: int = 2000;
2. Console print statement: println () and print ()
Anyone who has learned C or C ++ knows this and prints logs. The usage is similar, but the difference is that println ("A: % d", a); is not allowed, but println ("A: \ ()");
3. latency statement: Sleep (1); // latency 1 second
4. Clear screen statement: System ("clear screen"); // The console cannot appear
5. constants and variables:Constants are modified with let, and variables are modified with var..
6. semicolon:If only one line of code can be omitted and compiled, this semicolon can be omitted.
5. Question Mark and exclamation point :? Is to identify the variable as an optional variable or can be empty ,! Is to get the non-null value of the optional variable ,! It can also be used to identify variables as optional variables.