• Swift 命名规则


    Swift可以使用几乎任何字符作为常量和变量名,包括Unicode,但是不能包含数字符号、箭头、无效的Unicode、横线-、制表符、且不能以数字开头。

    var π = 3.14

     

    var 新空气软件 = "开发软件"

     

    let 你好 = "你好世界"

     

    整形的表现形式

    二进制:前缀0b

    八进制:前缀0o

    十六进制:前缀0x

    let decimalInteger = 14

    let binaryInteger = 0b10001

    let octalInterger = 0o21

    let hexadecimlInteger = 0x11

     

    let minValue = UInt8.min

    let maxValue = UInt8.max

    UInt8 是一个结构体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 }


    }

     

    //类型别名

     

    typealias NSInteger = Int

     

    var value: NSInteger = 45

     

    value = 12

     

    print(value)

     

    // 布尔类型

    var tigerIsAnimal: Bool = true

     

    1
  • 相关阅读:
    X-Sequence
    Little Bishops uva861
    组合数学poj 1496 1850 同样的代码过两题
    Frame Stacking 框架堆叠
    ディクショナリテーブル
    財務会計関連(FI&CO)
    開発者向け
    ABAP 7.51 構文書き方変換について
    ABAP News for Release 7.51 – ABAP CDS Client Handling
    パフォーマンス分析関連
  • 原文地址:https://www.cnblogs.com/fantasy3588/p/5064993.html
Copyright © 2020-2023  润新知