IOS swift Lesson 1 Basic code, iosswift Lesson 1

Source: Internet
Author: User

IOS swift Lesson 1 Basic code, iosswift Lesson 1

Seeing these codes reminds me of the long-overdue C.

Import Foundation

Var str = "Hello World"

Var sdd: Int

Sdd = 100

Let stt = 1

Var sz = Int [] ()

Let sz1 = [1, 2, 3]

Print (str)

 

The first sentence is import Foundation import module. The terminology is also the meaning of import package and library.

The second statement declares a variable str, which can change the value.

The third statement declares an unassigned Int type variable.

Fourth, change the variable value

In the fifth sentence, declare a constant stt and define it as 1. This constant cannot be changed. (Use this more to make the program safer)

6. Declare an empty array of Int type

7. Declare an unchangeable Array

In the eighth sentence, print means to output the str value.

 

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.