Swift's primary exploration of a

Source: Internet
Author: User

Today installs the Xcode6-beta edition, wants to experience the SWIFT charm: installs the SWIFT System the minimum version number is: 10.9.3

Just take a look at a little bit of the Swift programming Language, here's to share: (to be Continued ...) )

Playground-noun:a place where people can playimport cocoa///1. Declares a mutable variable var str = "Hello, Playground"///2. Declaring a constant let IMP Licitinteger=70let IMPLICITDOUBLE=70.0//3. Clear declare a variable variable name: type = initial value let EXPLICITDOUBLE:DOUBLE=70//clear Declare a Double variable let Explicitfloat:float=4///4.  Type conversion let label= "the width are" let Width=94let widthlabel=label+ "" +string (width)//coercion type conversion///5. Use the \ () string to include the variable let Apples=3let oranges=5let applesummary= "I had \ (apples) apples" let fruitsummary= "I had \ (Apples+orang es) pieces of fruit. " 6. Use [] to declare an array or dictionary//6.1 declare an array var names=["Lves Li", "Wildcat", "LeLe"]var lele=names[2]//Get array contents names[1]= "Cat"//Change array Elements in Names//["Lves li", "Cat", "LeLe"]//6.2 Declaration of a dictionary var info=["lves Li": "Mei Man paper", "Wildcat": "Handsome Pot", "LeLe": "Yard Farm"]var lIn fo=info["Lele"]info["lves"]= "programmer" info//[lves: Programmer, lves Li: Beauty man paper, Wildcat: Hot Pot, Lele: yards Nong]//6.3 Create an empty array or dictionary let Emptyarray =string[] () let emptydictionary=dictionary<string,float> () var shoppinglist=[]//Declare an empty array


The official recommendation is to use playground to view effects without compiling in real time:



Reprint please specify, this article turn from: Http://blog.csdn.net/wildcatlele not finished ...


Swift's primary exploration of a

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.