Create a swift project:
Come to the main function, what? Can't find the main function like OC?
Stop the nonsense, on the code, I will analyze:
//fundation Basic PackageImport Foundation//Do not execute main function, execution order from top to bottom//Execute this prinr function//Lua Pathon language does not require a semicolonPrint ("Hello, world!.")//define variable int A; variable definitions start with Var and declare a variable//MyVar is a variable name, where the name of the variable needs some initializationvar MyVar =0MyVar= - //variable name can be assigned again//\ () indicates that the contents of the (inside) can be calculatedPrint"my var is: \ (myVar)")//String (MyVar) is the object that is converted to a string typePrint"my var2 is"+String (MyVar))//Define a variable: represents the type Int denotes the declaration typevar myvar3:int = $;p rint ("my var3 is \ (MYVAR3)") var myvar4:double=3.1415926;p rint ("my VAR4 is\ (MYVAR4)")//let means to set an immutable variable, change the errorLet MYVAR5 = -;//MYVAR5 = +;Print"my var5 is \ (MYVAR5)") var myVar6= -; var myVar7= -; var myVar8= MyVar6 +Myvar7;print ("myVar8 is \ (MYVAR8)")//Country is a variable namevar name ="XZR"Print ("name is \ (first name)")
Yes, I did not execute the main function, it came to our Main.swift file after it was executed sequentially from top to bottom, I added a note, understand?
Well, command + R, you can see it!!!
An epiphany! As for writing norms to practice more practice to practice more, important things to say three times three times three times.
Summary: Later perfect ...
Swift Basic Writing specification