zoukankan      html  css  js  c++  java
  • Day2 (operation)/(optional Value of double eye Value)

    let secondSystem:Int = 0b10001

    let eightSystem:Int  = 0o21

    let tenSystem:Int    = 17

    let sixthSystem:Int  = 0x11

    // summary: 1.u need insert a "Enter" behind equal symbol 

     

    let num_a:Float = 1

    let num_b:Int = 1

     

    let a:Int = 3

    let b:Double = 0.1415926

    let pi:Double = Double(a) + b

    // summary: 2.it need change two number's type in the same ,in order to getting the result

     

    let bignum_a:Float = 10/2.5

    let bignum_a2:Int = 10/3

    let bignum_b:Float = Float(Int(1.2))*10.1

    let bignum_c:Int = Int(3.99)

    // summary: 3.it need change two number's type in the same ,in order to getting the result

    //          4.forcing number type need add type symbol in the front of number

     

    let jy = "爱下厨"

    let address = ".Jianggan,Hangzhou City,ZheJiang Province,China"

    jy + address

     

    let params = (isLoginSuccess:true,name:"tommy",age:25)

    let (isLoginSuccess,name,age) = params

    let isLginSuccess = params.0

    let whats = params.name

    let whatsage = params.2

     

    let (isTrue,_,_) = params

    if (isTrue)

    {

        print("login success!")

    }

     

    let personArray = ("a","b","c","d")

     

    let aPerson = personArray.0

    let bPerson = personArray.1

    // summary: 5. Tuples

     

    var value_a:Int

    value_a = 1

     

    var imOptionalVariable:Int?

    // summary: it's equal to nil when the optionalVariable is empty

     

    imOptionalVariable = 56

     

    let name = "Tommy"

    var age = Int(name)

     

    if age != nil

    {

        print("it's not empty")

    }

    else {

        print("it's empty!")

    }

     

    let userage = "25"

    var currentAge = Int(userage)

    let currentnewAge = Int(userage)

    // summary: String toInt use method : Int(string)

     

    if currentAge != nil

    {

        print("age: (currentAge)")

        print("his age is " + String(currentAge!))

    }

     

    if userage .isEmpty

    {

        print("age: (userage)")

    }else {

        print("age :(userage)")

    }

     

    let stringA:String? = "optional_String"

    let string2 = "_/stringA"

    var stringB = stringA! + string2

    stringA

    stringA!

  • 相关阅读:
    HDU 2122 HDU Today(dijkstra+map)
    DEDECMS后台传附件图片出现Upload filetype not allow解决办法
    织梦dedecms如何显示所有文章列表
    dedeCMS标签调用技巧和大全
    dedecms二次开发总结 变量参数
    dedecms上传图片相对路径改成绝对路径方法
    织梦Dedecms网站后台无法上传图片的步骤详解
    dedecms列表页调用当前文档的tags并带链接
    dedecms 自动获取缩略图
    dedecms网站转移(更换空间转移数据方法)
  • 原文地址:https://www.cnblogs.com/tony0571/p/5346447.html
Copyright © 2011-2022 走看看