Tag: swift
2.3 my first swift Program
Step 1: Create a new playground sports field program example
In application, select xcode. after entering the "Welcome to xcode" window, select "get started with a playground ", to create a new playground event program example.
650) This. width = 650; "class =" alignnone wp-image-5673 "src =" http://www.powenko.com/wordpress/wp-content/uploads/2014/08/12.jpg "alt =" 12 "width =" 560 "Height =" 328 "/>
12.
Step 2: Determine the storage location
Next, determine the location of the stored statement.
650) This. width = 650; "class =" alignnone wp-image-5674 "src =" http://www.powenko.com/wordpress/wp-content/uploads/2014/08/13.jpg "alt =" 13 "width =" 560 "Height =" 425 "/>
Memory location of lifecycle 13
Step 3: Enter the playground Field Program Mode
Enter the playground Field Program mode in the xcode environment. 650) This. width = 650; "class =" alignnone wp-image-5675 "src =" http://www.powenko.com/wordpress/wp-content/uploads/2014/08/14.jpg "alt =" 14 "width =" 560 "Height =" 557 "/>
14. Enter the playground Field Program Mode
Step 4: Enter the playground Field Program Mode
Enter the following program.
Example 2-1 myplayground. Playground
Import cocoa // Add the function to define cocoa
VaR STR = "Hello, playground" // change the STR parameter to "Hello, playground"
Println ("how are you? ") // Text display
Println (STR)
VaR a1 = 10 // set the variable A1
A1 = A1 + 1 // A1 plus 1
Step 5: Program publish
When swuft is created, the relevant changes on the right side are displayed on the plane,
If you want to write a program, click the circle in any item on the right. 650) This. width = 650; "class =" alignnone wp-image-5676 "src =" http://www.powenko.com/wordpress/wp-content/uploads/2014/08/15.jpg "alt =" 15 "width =" 560 "Height =" 430 "/>
Revision 15 modified program faces
Step 5: Console Output Window
The console output window appears on the right side of the entire program. If you want to close the window, click "X" in the upper right corner and press "continue, you can disable it.
650) This. width = 650; "class =" alignnone wp-image-5677 "src =" http://www.powenko.com/wordpress/wp-content/uploads/2014/08/16.jpg "alt =" 16 "width =" 560 "Height =" 325 "/>
The console output window is displayed in limit 16.
The result of the rows:
The line result of this program shows that the second line of text is different
How are you
Hello, playground
650) This. width = 650; "class =" alignnone size-full wp-image-5678 "src =" http://www.powenko.com/wordpress/wp-content/uploads/2014/08/17.jpg "alt =" 17 "width =" 528 "Height =" 117 "/>
17 then the result is returned.
This article is from the "Ke Bo Wen Lao Jie" blog, please be sure to keep this source http://powenko.blog.51cto.com/8340419/1538826