Swift 2.3 my first swift Program

Source: Internet
Author: User

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

  1. Import cocoa // Add the function to define cocoa


  2. VaR STR = "Hello, playground" // change the STR parameter to "Hello, playground"

  3. Println ("how are you? ") // Text display

  4. Println (STR)

  5. VaR a1 = 10 // set the variable A1

  6. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.