Data types for Swift

Source: Internet
Author: User

A reference type is the passing of its own data when assigning or passing a parameter pair to a function, so that during the invocation of the function, the original data is affected and the class belongs to the reference type



1. Integral type:

Int8: Signed 8-bit integer type;

Int16: Signed 16-bit integer

Int32:

Int64:

INT: Platform-related signed integer


UInt8: Unsigned 8-bit integer

UInt16: Unsigned 16-bit integer

UInt32:

UInt64:

UINT: Platform-dependent unsigned integer




2, floating-point type


Float


Double:



How numbers are represented:


Assign a decimal, binary, hexadecimal to an integer variable, and they are represented as follows,

(1) Binary number: 0b bit prefix, 0 is Arabic numerals, B is English lowercase letters, can not be capitalized;

(28 binary: prefix 0o, 0 is Arabic numerals, 0 is English lowercase letters;

(3) 16 binary: prefix 0x, 0 is Arabic numerals



Conversions between numeric types:


(1) Conversion between integral types;

UInt8 (Var)


(2) Conversion between integral type and floating point;


Float (Var)


3. Boolean type

True

False



4, Character type




5, meta-group:


A tuple is a concept in a relational database, a table in which each row of data is a tuple, and each column is an attribute, and a tuple becomes a record in a two-dimensional table.


var stu0= ("Tony", "100", "1")


var stu1= ("name": "Tony", "id": "+", sex:1)


println (stu0.0)

println (Stu1.name)


Let (name,id,sex) =stu1

Let (name,id,_) =stu1

println (name)

println (ID)

println (Sex)



6. Collection



7. Enumeration



8. Structural Body




This article is from the "Ordinary Road" blog, please be sure to keep this source http://linjohn.blog.51cto.com/1026193/1619369

Data types for Swift

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.