Swift 2.0 Learning Notes (Day 8)-small constants, variable effects

Source: Internet
Author: User

original articles, welcome reprint. Reprint Please specify: Dongsheng's blog

Computer language learning has constants and variables, they are almost the soul of my code, leaving them I really "can't live"

constants are preceded by identifiers with keywords Let . The amount of constant whose value does not change during use, and the following is the declaration constant:

Let _Hello = "Hello"

note that constants can only be assigned at initialization time, if the _hello Assignment,

For example: _hello = "Hello, World"

The program will make an error.  

Variables come in.

variables are prefixed with the keyword var, which declares the variable:

var scoreforstudent = 0.0

StatementDoubletypescoreforstudentvariable, and initialized to0.0.

If more than one variable is declared and initialized in a statement, all variables have the same data type:

var x = ten, y = 20

In the declaration of multiple variables, you can also specify different data types:

var x = ten, y = True

which x is an integral type, y is a Boolean type.  

Welcome to follow Dongsheng Sina Weibo @tony_ Dongsheng.

Learn about the latest technical articles, books, tutorials and information on the public platform of the smart Jie classroom

More Products IOS,Cocos, mobile design courses please pay attention to the official website of Chi Jie Classroom:http://www.zhijieketang.com

Luxgen Classroom Forum Website:http://51work6.com/forum.php

Swift 2.0 Learning Notes (Day 8)-small constants, variable effects

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.