Swift Naming conventions

Source: Internet
Author: User

Swift can use almost any character as a constant and variable name, including Unicode, but cannot contain number symbols, arrows, invalid Unicode, horizontal lines-tabs, and cannot begin with a number.

var π= 3.14

var new air software = " development software "

Let's hello = " Hello World "

The form of shaping

Binary: Prefix 0b

Octal: Prefix 0o

Hex: Prefix 0x

Let decimalinteger =

Let binaryinteger = 0b10001

Let octalinterger = 0o21

Let hexadecimlinteger = 0x11

Let minValue = UInt8. Min

Let maxValue = UInt8. Max

UInt8 is a struct struct

{

Public struct UInt8: unsignedintegertype, comparable, equatable {

public var value:builtin. Int8

// A type that can represent the number of steps between pairs of

// values.

public typealias Distance = Int

// Create An instance initialized to zero.

public init()

// Create An instance initialized to ' value '.

public Init(_ value: UInt8)

public init(_builtinintegerliteral value:builtin. Int2048)

// Create An instance initialized to ' value '.

public init(integerliteral value: UInt8)

public static var max: UInt8 {get}

public static var min: UInt8 {get}


}

type aliases

Typealias Nsinteger = Int

var value: nsinteger =

Value =

Print(value)

Boolean type

var tigerisanimal: Bool = true

Swift Naming conventions

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.