SWIFT-02-Constants and variables

Source: Internet
Author: User
: Playground-noun:a place where people can playimport uikitvar str = "Hello, Playground"//Constants defined with Letlet Maxlogincount = 10//variable is defined with Varvar Currentlogincount = 0currentLoginCount = 3//Define multiple variables or constants at the same time var x = ten, y =, z = 30//when defining constants, use uppercase as much as possible Let PI = 3.14159, speedoflight = 300_000//Same as 300000, underline to make it easy to distinguish how many 0//define a variable can give a specified type, such as allow mincount:int = 10//declaration This is an integer constant V Ar name:string = "Rinpe Chan"//Declare this is a string variable//But Swift automatically recognizes the type//variable name based on the assigned value not only in English, but also in Chinese and emoticons let? = "Bull Bull" var hello = "Hello, world" Hello = "world, hello"//output print (??) Print (hello) print ("Current login: \ (currentlogincount)") print ("π equals \ (pi)")

  

SWIFT-02-Constants and variables

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.