<em id="ddznf"></em>

<form id="ddznf"></form>
<noframes id="ddznf">

    
    

        swift 2.2基本數據類型



        整數


        1.分為有符號整數和無符號整數;


        2.有符號: Int8 Int16 Int32 Int64 Int;


        3.無符號: UInt8 UInt16 UInt32 UInt64 UInt。


        整數類型區別


        1.在內存占用空間不同(sizeof(Type)獲取);


        2.表達的數據范圍不同(可用min,max屬性獲取)。


        Tips


        1.特殊整數類型Int,長度與當前平臺原生字長一致;


        2.32位機,sizeof(Int)等于sizeof(Int32);


        3.64位機,sizeof(Int)等于sizeof(Int64);


        4.UInt類似;


        5.習慣在一般情況下使用Int,來提高代碼一致性和可復用性。



        浮點數


        1.Float 32位浮點數;


        2.Double 64位浮點數。


        0.png



        布爾值


        Bool(true false)



        其他


        1.類型轉換;


        2.類型別名;


        3.類型安全。


        swift是類型安全的語言,在編譯時進行類型檢查。



        代碼實例


        //: Playground - noun: a place where people can play
         
        import UIKit
         
        //: 聲明整數并觀察類型推倒結果
         
        let intVal = 1
        intVal.dynamicType
         
        let int8Val : Int8 = 1
        let int16Val : Int16 = 1
        let int32Val : Int32 = 1
        let int64Val : Int64 = 1
        let intVal1 : Int = 1
         
        print("Int8 \t size: \(sizeof(Int8)) \t min: \(Int8.min) \t\t\t\t\t max: \(Int8.max)")
        print("Int16 \t size: \(sizeof(Int16)) \t min: \(Int16.min) \t\t\t\t max: \(Int16.max)")
        print("Int32 \t size: \(sizeof(Int32)) \t min: \(Int32.min) \t\t\t max: \(Int32.max)")
        print("Int64 \t size: \(sizeof(Int64)) \t min: \(Int64.min)  max: \(Int64.max)")
        print("Int \t size: \(sizeof(Int)) \t min: \(Int.min) \t max: \(Int.max)")
         
        var uint8Val : UInt8 = 1
        var uint16Val : UInt16 = 1
        var uint32Val : UInt32 = 1
        var uint64Val : UInt64 = 1
         
        print("UInt8 \t size: \(sizeof(UInt8)) \t min: \(UInt8.min) \t max: \(UInt8.max)")
        print("UInt16 \t size: \(sizeof(UInt16)) \t min: \(UInt16.min) \t max: \(UInt16.max)")
        print("UInt32 \t size: \(sizeof(UInt32)) \t min: \(UInt32.min) \t max: \(UInt32.max)")
        print("UInt64 \t size: \(sizeof(UInt64)) \t min: \(UInt64.min) \t max: \(UInt64.max)")
        print("UInt \t size: \(sizeof(UInt)) \t min: \(UInt.min) \t max: \(UInt.max)")
         
        let dVal = 1.1
        dVal.dynamicType
         
        let floatVal : Float = 1.1
        let DoubleVal : Double = 1.1
         
        print("Float \t size: \(sizeof(Float))")
        print("Double \t size: \(sizeof(Double))")
         
        let decimalVal = 10
        let binaryVal = 0b1010
        let octVal = 0o110
        let hexval = 0x10
         
        let exponentDouble1 = 12.12e1
        let exponentDouble2 = 12.12e-1
        let hexDecimalDouble = 0x12.3p1
         
        //uint8Val = intVal
        //uint8Val = UInt8.max + 1
         
        uint8Val = UInt8(intVal)
        let doubleRes = 1.34 + 5
         
        let double1 = 1.34
        let int1 = 5
        let res = double1 + Double(int1)
         
        typealias Distance = Int
        let longDistance : Distance = 1
        longDistance.dynamicType
        Distance.min
        Distance.max
         
        let amiICool = true
        if amiICool {
            print("tks")
        }
         
        var doubleVal1 = 1.1



        【本文由麥子學院獨家原創,轉載請注明出處并保留原文鏈接】

        logo
        ? 2012-2016 www.ddlua.com
        蜀ICP備13014270號-4 Version 5.0.0 release20160127

        免費領取價值1888元求職寶典!

        客服熱線 400-862-8862

        回到頂部

        916官方彩票 www.6868565.com | www.557337.com | www.296233.com | www.72477b.com | feicai0510.com | www.7893w35.com | vip4048.com | www.25688n.com | www.bet3650814.com | 2381kkk.com | www.30305.com | 30179988.com | www.26878b.com | www.yh8333.com | 0088.com | www.73990o.com | 9649n.com | www.956458.com | www.pj8470.com | 61652u.com | www.621233.com | 3121rr.com | www.560121.com | www.312288a.com | 4066kk.com | www.68568m.com | www.tushan48.com | 500000471.com | www.eee2848.com | 8827oo.com | www.235953.com | www.6889757.com | 22117j.com | www.6ttz.com | www.r456x.com | zzz1915.com | www.656121.com | www.tm012.com | 55967m.com | www.60007l.com | www.362838.com | pj75.com | www.6364r.com | www.34557.com | 36404433.com | www.39500c.com | www.0860k.com | 559649.com | www.54400l.com | www.g30226.com | 866666g.com | www.7714b.com | www.101717.com | 50023355.com | www.1368l.cc | www.988800.com | 93922v.com | www.703270.com | www.5504y.com | 76886j.com | www.444070.com | www.7334f.com | 11989h.com | vipxinquan.com | www.yz7702.com | www.jinsha200.com | gm13800.com | www.81233n.com | www.358nn.com | 61999yy.com | www.fcff1.com | www.55526i.com | 预览444000p.com | 3122t.com | www.1100.net | www.774167.com | 3846ooo.com | www.523745.com | www.7893w37.com | www.bh11234.com | 53166l.com | www.29699.com | www.295555.com | 54241100.com | 188qq999.com | www.3890a.com | www.sj52288.com | 97799d.com | 1634q.com | www.33588l.com | www.zs5555.com | yzc329.com | 76543l.com | www.7239p.com | www.hg8259.com | 663334.com | 463e7.com | www.66376l.com | www.zte777.com | q2554.com | cp36936.com | www.2373i.com | www.caipiao88f.com | 2017.net | ll00558.com | www.529026.com | www.765.me | www.8888855555.com | 463393.com | 88021.com | www.9205f.com | www.1064g.com | www.js60g.com | 500000394.com | www.584511.com | www.3398788.com | www.x100100.com | 19880s.com | 2776j.com | www.723035.com | www.3434ccc.com | www.1213699.com | l7742.com | wh1020.com | www.901376.com | www.56011y.com | www.lefa888.com | feicai0572.com | 118888c.com | www.310477.com | www.0073.com | www.5250666.com | www.pj9704.com | 44hh.bet | 44077n.com | www.52072m.com | www.6364z.com | www.11521.com | www.5816ee.com | 2709b.com | 6345544.com | 73999x.com | www.am7779.com | www.55676p.com | www.489239.com | www.yh77899.com | qmbc6.com | 9964j.com | 7811yy.com | www.fen00.com | www.12136i.com | www.06982.com | www.020xpj.com | 55331mm.com | 3534t.com | 88740c.com | www.cb6888.com | www.hg0297.com | www.38345h.com | www.68610022.com | 4638855.com | 61323399.com | 64111s.com | 5005i.com | www.603614.com | www.81678p.com | www.1754b.com | www.521138.com | www.22799.com | w9w8w7.com | r01234.com | 008423.com | 3644y.com | www.315019.com | www.5177.cc | www.2418c.com | www.88325e.com | www.0788msc.com | www.spj57.com | www.pj6698.com | xpj888a.com | 2096c.com | 563745.com | 4880o.com | www.29277o.com | www.657069.com | www.2qxc.com | www.3005w.com | www.7714o.com | www.qiji333.com | www.2000c.cc | www.89677n.com | www.58665p.com | www.0709.com | www.n2678.com | www.long260.com | 6137h.com | 1479a.com | www.210927.com | b5136.com | 009900h.com | www.hg8056.com | www.bet353655.com | goodmgm.com | 3957b.com | www.hg3385.com | www.68365s.com | www.137651.com | 4465d.com | www.5626k.com | www.x88678.com | www.62118a.com | 3788h.com | www.6178056.com | www.x777678.com | www.39500u.com | aipin11.me | www.6410a.com | www.376500hd.com | judingbo6.com | 72239.com | www.ag6215.com | www.6611a.cc | 9679r.com | www.5554dhy.com | www.45598i.com | www.7793t.com | 113365.com | 65005k.com | www.77958.com | www.84499y.com | 69990g.com | 3122o.com | www.19yh8.com | www.cf9902.com | 162788.com | www.yinhe9507d.com | www.9895u.com | www.364077.com | 3957w.com | www.333133j.com | www.1558666.com | www.097968.com | 7720y.net | www.k1128.com | www.26299f.com | 83086w.com | www.55123.com | www.88325m.com | www.369072.com | 7003oo.com | www.mp506070.com | www.9711c.com | 50066.com | www.bwin599.com | www.86339h.com | 55818s.com | w2490.com | www.4444yh.vip | www.622703.com | 908080y.com | www.25000.com | www.gyfc7.com | 0073.com | www.214777.com | www.3478g.cc | 5099ww.com | www.34656.com | www.8667z.com | 4270ll.com | www.1596e.com | www.26163h.com | 9123567.com | www.hg8475.com | www.6364d.com | pj520.com | www.33396.com | www.ybao6.com | 3473w.com | www.78z5.com | www.445888a.com | 3778tt.com | www.597567b.com | www.808482.com | 3y5511.com | www.055888.com | www.839658.com | jz696.com | www.77731p.com | www.609810.com | 9737003.com | www.4196x.com | 667766g.com | www.yh1088.com | www.6386a.com | 39966.com | www.bet3651014.com | www.3790011.com | 1466s.com | www.jj905.net | www.ac9911.com | 3242k.com | www.5446oo.com | aa3335.com | 27878ii.com | www.33vn777.com | 644237.com | www.pj8288.com | www.gczj2.com | 00uu8332.com | www.365099.bet | 2649rr.com | www.07078006.com | www.34czj.com | 9679z.com | www.85857j.com | 7196t.com | www.6491d.com | www.12455hh.com | 1443b.com | www.xam03.com | www.312012.com | 80892nn.com | 44ms888.com | www.8905v.com | 66648u.com | www.fa208.com | www.388510.com | 500000878.com | www.13434c.com | www.3933m.cc | 1233015.com | www.9895w.com | 7155268.com | www.370370.com | www.653546.com | www.9846k.com | www.52001.cc | 28288rr.com | www.yh8899.bet | 56988m.vip | www.c5c22.com | qg0707.com | www.848464.com | www.422626.com | 3938.com | www.73166.com | hubo8.cc | www.ylylc08.com | mm99922.com | www.5099zz.com | qy6682.com | www.pj238.com | 6647i.com | www.ylg2206.com | www.ya499.com | 33115a.com | www.83993p.com | 1865.com | www.97828e.vip | 1cp077.com | www.6880mm.com | b05677.com | www.97060c.com | 111122.com | www.w12111.com | 022573.com | www.wns47.com | www.037169.com | www.xpj2025.com | www.77114a.com | www.sun09.com | www.258031.com | www.wns911.com | www.680221.com | www.h5505.com | www.611669.com | www.pjbet666.com | www.569829.com | www.76543z.com | www.586005.com | www.4107j.com | www.665478.com | www.777444r.com | www.303861.com | www.2846b.com | www.237644.com | www.js889x.com | 29918k.com | www.5849.com | 1654i.com | www.930608.com | botanvip.com | www.7036jj.com | 3568h.com | www.100224.com | js7.ch | www.23579e.com | mm5443.com | www.62355.com | k10k120.com | www.862810.com | www.1310909.com | www.csw288.com | www.65175.com | 7894n.com | www.71071d.com | 123456yy.cc | www.5446a.com | 55331xx.com | www.50732g.com | 83377h.com | www.809217.com | www.p31888.com | vv680.com | www.66867.com | 28288cc.com | www.8577a.cc | 2677qqq.com | www.938905.com | www.p27229.com | amyh130.com | www.vns3938.com | 3559xxx.com | www.8905b.com | 9958988.com | www.78949s.com | www.0222js.com | www.237544.com | www.460707.com | 2096s.com | www.3691x.com | 66876j.com | www.843533.com | www.77537l.com | 377633.com | www.58404c.com | 888.cm | www.03czj.com | www.9547l.com | vbet.io | www.565548.com | 85698r.com | www.722571.com | www.77938.com | hgbet.com | www.42456644.com | 776059.com | www.187515.com | www.61msxfpt2.com | 30170088.com | www.15239.cc | www.09569a.com | 4449193.com | www.557755.com | 8827ppp.com | www.332709.com | www.pm48.com | 3566bb.com | www.2350p.com | www.aa3143.com | 78114444.com | www.42842808.com | 56987ee.com | www.025727.com | www.yk222a.com | vns80579.com | www.7793c.com | www.5303v.com | ll1915.com | www.87668y.com | www.ag2020a.com | y1429.com | www.837929.com | zz57686.com | cr789.com | www.458633.com | 500000520.com | www.51515p.com | www.biying930vip.com | 76543z.com | www.89894b.com | www.694942.com | 2019s.cc | 7920.com | www.hg341.com | www.hg250.com | 820vv.com | www.9646u.com | www.649589.com | nnn5144.com | www.29277hh.com | www.js88058.com | 8381d.com | www.29277s.com | www.45625.com | 3380.com | www.676285.com | www.000amdc.com | 2141122.com | www.351089.com | www.299764.com | www.86611b.com | 1123222.com | www.d17848.com | www.142351.com | 4541l.com | www.658770.com | www.673888c.com | feicai0563.com | 025647.com | www.905647.com | www.ylzz1119.com | 5555vn77.com | www.am7654.com | www.58665i.com | 3258s.com | 840pj.com | www.37377o.com | www.tyc600.com | 9063555.com | www.791397.com | www.vns6607.com | www.1869b.com | 87680g.com | www.29277c.com | www.444230.com | feicai0536.com | 6220uu.com | www.50064l.com | www.38238y.com | 55331ll.com | 18894.com | www.43818n.com | www.617suncity.com | hga018.com | 44488a.com | www.77803p.com | www.817711.com | 3156rrr.com | bodog9393.com | www.5086o.com | www.79500u.com | zz57686.com | 5004ee.com | www.674679.com | www.742688.com | www.537msc.com | 08199.com | 9193.cc | www.50074j.com | www.fh70.com | feicai0354.com | 88535o.com | www.791397.com | www.40288l.com | www.777789pj.com | 20160913.com | 2127y.com | www.60108c.com | www.8967u.com | www.hg148.com | xpj5009.com | www.234269.com | www.1205.com | www.622msc.com | 64111j.com | 512800.com | www.401267.com | www.660066.vip | www.aa56108.com | 9030u.com | 667766xcom | www.513477.com | www.6666bj.com | www.998855f.com | www.645suncity.com | lll3405.com | 3156www.com | www.90egg.com | www.377666o.com | www.hg6607.com | 0906vip3.com | 66883885.com | www.424221.com | www.1178058.com | www.79500q.com | www.55268tt.com | yabo692.com | 1294h.com | www.268177.com | www.71233k.com | www.10999s.com | www.4938w.com | feicai00886.com | 6002e.com | 07qipai.cn | www.hqcp2.com | www.56011u.com | www.v56789.com | www.8494t.com | 5309789.com | 44jj8331.com | www.318021.com | www.42969.com | www.w84w.com | www.mgdc48.com | www.hg0088.co | facai86.com | aobo45.com | 2418s.com | www.608115.com | www.772222.biz | www.4996gz.com | www.699139.com | www.hg148.com | 888992244.com | 87680l.com | 3222.com | www.923733.com | www.81678s.com | www.47506c.com | www.9611h.com | www.546suncity.com | 3169m.com | qpby2277.com | qq365h.com | 0015dd.com | www.351089.com | www.ya308.com | www.0194003.com | www.783544.com | www.9411.am | www.7720x.com | u2306.com | 36406666.com | 4116i.com | xpj708.com | www.210715.com | www.zfcp5.com | www.bj1111.com | www.88166j.com | www.39678.com | www.333133r.com | 2851f.com | 68228n.com | 3950e.com | 7811ww.com | 6220x.com | 2400017.com | www.670665.com | www.979zf.com | www.504446.com | www.33678kk.com | www.hg8ff.com | www.678309.com | www.777444c.com | www.7435b.com | 5004ooo.com | nn500f.com | 4556h.com | 69447722.com | 2883kf.com | 00773t.com | amjs0161.com | www.097318.com | www.494969.com | www.933771.com | www.60007j.com | www.52022.tv | www.13434f.com | www.u2894.com | www.393002.com | www.88166w.com | www.js9652.com | www.22076.com | www.blm5544.com | www.81a88.com | www.ylg4444.com | 1259n.com | hwcp4444.com | 4461u.com | 4340bb.com | 2214o.com | 1992789.com | w08199.com | 18775l.com | 3473z.com | aa33332.com | a3665.com | 80892kk.com | 696.net | csj800.com | x3456.com | 0015rr.com | 1211.cc | 1766.com | 0250.com | 111hg88.com | 99567m.com | am51335.net | 55545l.com | 0201gg.com | zhcp21.com | jss1150.cn | j2976.com | 30007b.com | 9993657.com | wtx2563.com | 3678mmm.com | 3846a.com | 53358o.com | 3552g.com | 1588666.com | 9030k.com | yth15.net | y47479.com | www.ag9655.com | www.653508.com | www.333133n.com | www.3170002.com | www.72477b.com | www.05789.com | www.20199nn.com | www.71071j.com | www.955244.com | www.69567d.com | www.4809a.com | www.js1047.com | www.71399t.com | www.6364u.com | www.810513.com | www.500021.com | www.171880.com | 77116556.com | 7720h.net | 38989f.com | i14666.com | mohan2013.com | 44mm8331.com | www.amh50.com | www.hg083.com | www.348458.com | www.1299js.com | www.365066.bet | www.xj7003.com | www.97828i.vip | www.36788m.com | www.ch8345.com | www.622230.com | 11992007.com | 555v55.com | 3078j.com | 3559uu.com | 50732.com | www.518hwx.com | www.37vnsvns.com | www.7335y.com | www.bet63g.com | www.495.ee | www.8039w.com | www.652361.com | www.546411.com | 142788.com | 914910.com | 4152.com | feicai0734.com | 1wns.com | www.www-9644.com | www.249559.com | www.256531.com | www.js18684.com | www.7793h.com | www.364141.com | 51133hh.com | 8040www.com | a5429.com | www.56733z.com | www.899238.com | www.0590777.com | www.30350q.com | www.89894l.com | www.810521.com | 4637744.com | 7945ll.com | 4136w.com | www.dfs994.com | www.674suncity.com | www.0169a.com | www.2418t.com | www.49956k.com | www.271051.com | 35543.com | wenetian.net | www.1869k.com | www.00829b.com | www.249559.com | www.0343c.com | www.920564.com | 55145.com | 3957z.com | q58955.com | www.xpj8808.com | www.751cp33.com | www.48330f.com | www.cb0999.com | shsxiwl.cn | 98955v.com | 111122rr.com | www.xinhao77.com | www.6889757.com | www.6939w.com | www.hczx6.com | 5002z.com | amhg099.com | www.8124r.com | www.333010.com | www.178633.com | www.c2813.com | 1624bb.com | 53262k.com | www.32126i.net | www.998855s.com | www.50819.com | www.941194.com | 365644.com | bet28s.com | www.ms8873.com | www.7225j.com | www.4323s.com | www.320477.com | 54443w.com | 776071.com | www.hg7321.com | www.686727.com | www.655902.com | 9737dh.com | 3844j.com | www.amhg002.com | www.32031f.com | www.cb5588.com | b899.xyz | ggg8827.com | www.hg726.com | www.823250.com | www.hx1164.com | 2805z.com | 9995s.cc | www.683012.com | www.x22789.com | www.541911.com | 708365.com | 168cp-x.com | www.haomen2002.com | www.68993275.com | www.094918.com | 0166c.com | www.806313.com | www.3983184.com | www.ct8800.com | 55545l.com | 2127.com | www.456277.com | www.z63568.com | www.196146.com | 6175gg.com | www.8814e8.com | www.a2894.com | www.910997.com | 8000524.com | x48o.com | www.55545r.com | www.8839j.com | 66458f.com | 68963777.com | www.808888h.com | www.7782b.com | 55zz8331.com | bst979.com | www.92776.com | www.hy6262.com | 6661779.com | www.jinsha49.com | www.77ok.com | www.926013.com | 0824.com | www.pjdc4488.com | www.7366009.com | www.501346.com | ii40033.com | www.seqhi.com | www.0967004.com | 588-5.cc | 822930.com | www.35252z.com | www.54p.com | 11zz8331.com | www.ylhg5858.com | www.848777a.com | www.550314.com | sjg001.com | www.1166hg.com | www.7158.cc | 500000317.com | www.880478.com | bet28h.com | 3136ss.com | www.hg98j.com | www.514077.com | 3938vv.com | www.889123.com | www.81678b.com | 1294.com | www.090009.com | www.6687u.com | www.349177.com | 3726m.com | www.48599.com | www.68682k.com | pc0428.com | www.935365.com | www.14168c.com | feicai0580.com | mgm3242.net | www.4996gd.com | www.673266.com | b5957.com | www.736suncity.com | www.2875v.com | 59599a.com | www.suncity88.net | www.hd8671.com | 55984d.com | www.882745.com | www.688202.com | 6888zx.com | www.88807z.com | www.703wb.com | 66648u.com | www.912suncity.com | www.77210j.com | d6688.com | www.2016hg.com | www.94580.cc | 77606wcom | www.k1128.com | www.973776.com | 5219w.com | www.klcp385.com | www.577690.com | uu2649.com | www.19019r.com | www.33598e.com | 6220r.com | www.yjxxelxx.com | yh888d.com | www.22xpjdc.com | www.089728.com | 6033e.com | www.bet3650514.com | www.81520f.com | 79889f.com | www.2404000.com | www.71gcw.com | 3640.vip | www.3846w.com | www.485689.com | feicai0358.com | www.69567n.com | jjj5144.com | www.8814e4.com | www.8667k.com | 53262ee.com | www.8839.com | www.71233v.com | www.6033e.com | www.35898b.com | 3215888.com | www.423886.com | www.725422.com | 68228y.com | www.99552qq.com | www.98528i.com | www.10051005.com | www.96386h.com | 1166589.com | www.0999msc.com | www.262771.com | www.b6868.com | www.508048.com | 7681003.com | www.668cp33.com | x7742.com | www.040xpj.com | www.15355m.com | 4036kk.com | www.55070c.com | 1483nn.com | www.25288a.com | www.3668s.com | 6150u.com | www.12136u.com | 3424k.com | www.9m148.com | www.135125.com | www.vnsr600.com | www.80065f.com | 99589ff.net | www.00778k.com | 547902.com | www.5405006.com | www.447478.com | www.hg66768.com | www.36788k.com | 61328800.com | www.83377.com | 5004pp.com | www.r4042.com | 00773j.com | www.006087.com | www.610875.com | www.ylg2999.com | www.80075p.com | 61325500.com | www.91779d.com | y2146.com | www.27363t.com | 1483u.com | www.808777.com | www.503477.com | www.32126w.net | www.5854y.cc | 00774tt.com | www.pjzxyl.com | yh66555.com | www.280772.com | 1654q.com | www.e3065.com | 3522ss.cc | www.76577a.com | 1591.com | www.3959h.com | www.177478.com | www.hg083.com | www.607252.com | www.hg990022.com | www.qbwc3.com | 3377vn77.com | www.6832t.com | 6769.cc | www.99677y.com | vipvip1111.com | www.790964.com | pj08080.com | www.js18685.com | 7893w10.com | www.1118yl.com | hhvip86.com | www.56011k.com | 65365.com | www.56011v.com | 3640w.com | www.260655.com | hb68066.com | www.CK1432.COM | 00qq8331.com | www.5265.com | gsq520.com | 3559t.com | www.377666y.com | 2172223.com | www.33678oo.com | tt6832.com | www.089456c.com | www.133615.com | www.as0004.com | www.0033xpj.net | www.899485.com | 55331gg.com | www.66376y.com |