<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.83033z.com | www.50026q.com | www.792587.com | www.0014w.com | www.41518j.com | www.78700l.com | www.072211.com | www.627012.com | www.jx68.com | www.9889hc.com | www.9818m.cc | www.500cd.com | www.23040.com | www.109ak.com | www.3479a.com | www.9205d.com | www.hczx7.com | www.627868.com | www.138037.com | www.202427.com | www.312180.com | www.530391.com | www.631799.com | www.81678h.com | www.23636m.com | www.94238.com | www.9889hc.com | www.810852.com | www.599831.com | www.605366.com | www.028314.com | www.66332d.com | www.68682h.com | www.7782h.com | www.8000hc.com | www.543411.com | www.35918t.com | www.88266k.com | www.781566.com | www.530396.com | www.95333w.com | www.c229.net | www.311332.com | www.29277k.com | www.22dwj.com | www.587335.com | www.86267hh.com | www.qbwc5.com | www.323518.com | www.35155z.com | www.897296.com | www.701495.com | www.202880.com | www.9205a.com | www.535666e.com | www.80767s.com | www.50051n.com | www.535hc.com | www.178379.com | www.076wy.com | www.332071.com | www.95222w.com | www.937160.com | www.508680.com | www.50064g.com | www.370833.com | www.80065d.com | www.598966.com | www.39500m.com | www.547477.com | www.50788y.com | www.cbw222.com | www.025738.com | www.993621.com | www.357173.com | www.595hc.com | www.51515b.com | www.789755.com | www.5522h.cc | www.ywzuqiu.com | www.960207.com | www.73166b.com | www.904830.com | www.77801u.com | www.821260.com | www.9478w.com | www.77801o.com | www.587991.com | www.fei27.com | www.43131z.com | www.694880.com | www.5109.cc | www.50026m.com | www.393937.com | www.wcp777888.com | www.022sc.cc | www.52072j.com | www.yw373.com | www.bxcp3.com | www.8667v.com | www.99677z.com | www.001837.com | www.461113.com | www.cp2838.com | www.696by.com | www.9478b.com | www.26299p.com | www.26878k.com | www.191380.com | www.657832.com | www.8618aa.com | www.49956y.com | www.25688e.com | www.312012.com | www.540977.com | www.701775.com | www.c6881.com | www.79520c.com | www.81678w.com | www.65707d.com | www.569380.com | www.701546.com | www.ch8944.com | www.fyyy1.com | www.h701.com | www.982570.com | www.989841.com | www.ck09.com | www.912278.com | www.926280.com | www.848066.com | www.826927.com | www.677375.com | www.536411.com | www.501206.com | www.451956.com | www.330832.com | www.235944.com | www.524277.com | www.412228.com | www.190994.com | www.196309.com | www.025727.com | www.60123r.com | www.52303w.com | www.9711c.com | www.318548.com | www.cp718.net | www.745568.com | www.509866.com | www.095335.com | www.08588l.com | www.14177.com | www.676zf.com | www.ac3322.com | www.912485.com | www.347177.com | www.66332l.com | www.49956c.com | www.c299.com | www.83993e.com | www.32123s.com | www.ascp1.com | www.550174.com | www.86267d.com | www.77801j.com | www.3478z.cc | www.702572.com | www.197880.com | www.84499w.com | www.658zf.com | www.609816.com | www.025616.com | www.50074d.com | www.c5637.com | www.546411.com | www.78700m.com | www.1248h.cc | www.550116.com | www.26299f.com | www.2875r.com | www.599849.com | www.61655i.com | www.2875s.com | www.809215.com | www.118428.com | www.87498.com | www.rcw8855.com | www.50054y.com | www.fh1188.com | www.311414.com | www.00840y.com | www.701775.com | www.12455m.com | www.c229.net | www.53900h.com | www.890402.com | www.65707h.com | www.kc66.com | www.83033n.com | www.lczg3.com | www.108075.com | www.202115.com | www.202341.com | www.5xca.com | www.54400a.com | www.hcw823.com | www.68568o.com | www.hc5859.com | www.61233p.com | www.535666e.com | www.33598m.com | www.701269.com | www.41518x.com | www.375931.com | www.2934x.com | www.092603.com | www.969761.com | www.49956s.com | www.250756.com | www.lycp886.com | www.39500n.com | www.646377.com | www.2373b.com | www.095588.com | www.866367.com | www.81233q.com | www.lcw997.com | www.df79.com | www.500pt.com | www.096308.com | www.796678.com | www.3416e.com | www.43131s.com | www.535059.com | www.slyl1.com | www.98528c.com | www.504533.com | www.cp3158.cc | www.26299f.com | www.66653s.com | www.532918.com | www.216777aa.com | www.063wy.com | www.12455m.com | www.99677m.com | www.hcw018.com | www.w459.com | www.977hf.com | www.83033d.com | www.66332w.com | www.234397.com | www.646452.com | www.500cd.com | www.33997x.com | www.84499s.com | www.550263.com | www.881809.com | www.yi660.com | www.5522g.cc | www.1176.cc | www.35918m.com | www.43818e.com | www.026918.com | www.171209.com | www.483552.com | www.616330.com | www.791561.com | www.836595.com | www.hx1114.com | www.5xgf.com | www.911888a.com | www.982090.com | www.csw288.com | www.901576.com | www.941718.com | www.331616a.com | www.hf1680.com | www.lcw997.com | www.hy5505.com | www.hm2299.com | www.981090.com | www.900241.com | www.860836.com | www.820535.com | www.665881.com | www.540707.com | www.196146.com | www.108065.com | www.33997u.com | www.50054r.com | www.7793o.com | www.85gcw.com | www.50024y.com | www.2373y.com | www.lyc55.com | www.925073.com | www.602891.com | www.rcw8866.com | www.025727.com | www.80075d.com | www.50024.com | www.qucw3.com | www.629965.com | www.115779.com | www.77801q.com | www.008ac.com | www.926887.com | www.490680.com | www.61233l.com | www.9818t.cc | www.572699.com | www.335037.com | www.50080a.com | www.9928j.com | www.848266.com | www.99677f.com | www.45565.cc | www.590808.com | www.60108n.com | www.361gc.com | www.769588.com | www.081502.com | www.15355r.com | www.xcw866.com | www.83033x.com | www.cll168.com | www.596960.com | www.50052l.com | www.588yc.com | www.553079.com | www.00665h.com | www.tlcp3.com | www.382780.com | www.81520g.com | www.c6002.com | www.61233f.com | www.6fa500.com | www.278688.com | www.09500w.com | www.375793.com | www.35155m.com | www.592771.com | www.35918k.com | www.576126.com | www.33588z.com | www.690477.com | www.80065g.com | www.605670.com | www.26299y.com | www.379477.com | www.3005.am | www.212632.com | www.cll168.com | www.276081.com | www.9889hc.com | www.130511.com | www.qmfc7.com | www.73166i.com | www.959553.com | www.bxcp3.com | www.577972.com | www.2632n.com | www.175905.com | www.cf9904.com | www.00840h.com | www.401285.com | www.88ttz.com | www.35918s.com | www.lcw997.com | www.977hf.com | www.50052y.com | www.461770.com | www.flff6.com | www.77114d.com | www.282990.com | www.916720.com | www.7793d.com | www.66653r.com | www.440689.com | www.c96683.com | www.37193.cc | www.50732c.com | www.355274.com | www.918356.com | www.622by.com | www.61233z.com | www.88266i.com | www.665993.com | www.hm3555.com | www.9356l.com | www.41518x.com | www.065766.com | www.567206.com | www.987434.com | www.202115.com | www.57022.cc | www.99638.com | www.81233f.com | www.66332e.com | www.196016.com | www.le33.cc | www.647311.com | www.915044.com | www.fh7557.com | www.bang | www.022y.cc | www.9889hc.com | www.50024k.com | www.66376t.com | www.36166x.com | www.66621d.com | www.77802i.com | www.99788k.com | www.101136.com | www.231002.com | www.319989.com | www.330175.com | www.986399.com | www.yc7701.com | www.308126.com | www.335284.com | www.292726.com | www.196203.com | www.106367.com | www.bxcp3.com | www.81233m.com | www.99677q.com | www.51515v.com | www.29277m.com | www.81233s.com | www.33997t.com | www.5441d.com | www.2109h.com | www.071wy.com | www.qbwc2.com | www.863012.com | www.507633.com | www.354611.com | www.025069.com | www.33112m.com | www.50080s.com | www.2875x.com | www.cp5658.cc | www.626212.com | www.377939.com | www.66652b.com | www.29277x.com | www.588yc.com | www.703602.com | www.98528f.com | www.43818i.com | www.7782x.com | www.927986.com | www.375769.com | www.39500d.com | www.9050.cc | www.701497.com | www.175969.com | www.49956t.com | www.hczx7.com | www.548912.com | www.50052s.com | www.9889hc.com | www.551475.com | www.55228j.com | www.062wy.com | www.573477.com | www.36166z.com | www.500cd.com | www.375791.com | www.68682j.com | www.997345.com | www.186357.com | www.78995.com | www.rcw567.com | www.84499h.com | www.669by.com | www.375916.com | www.08588q.com | www.763659.com | www.54400m.com | www.gocp4.com | www.109615.com | www.008ac.com | www.362588.com | www.00665d.com | www.574177.com | www.66095.cc | www.577285.com | www.50788m.com | www.647577.com | www.50732g.com | www.xinyc3.com | www.80075l.com | www.583792.com | www.81233cc.com | www.356036.com | www.1368.cc | www.106537.com | www.fh2622.com | www.43818h.com | www.729019.com | www.77802z.com | www.557089.com | www.662by.com | www.89894w.com | www.956568.com | www.80065m.com | www.503489.com | www.bxcp3.com | www.51515y.com | www.622709.com | www.3668w.com | www.87668b.com | www.838669.com | www.6769b.com | www.bxcp3.com | www.735037.com | www.2408e.cc | www.08588o.com | www.355711.com | www.ck1178.com | www.25688j.com | www.106536.com | www.665991.com | www.bxcp3333.com | www.97655n.com | www.355183.com | www.864155.com | www.9050.cc | www.68689w.com | www.178763.com | www.760320.com | www.600hc.com | www.36788p.com | www.87668x.com | www.393937.com | www.824980.com | www.ya018.com | www.15355k.com | www.25688i.com | www.193987.com | www.558403.com | www.905866.com | www.rrle4.com | www.444xm.cc | www.5522d.cc | www.16878m.com | www.86267n.com | www.61655v.com | www.065966.com | www.327831.com | www.542998.com | www.638173.com | www.792088.com | www.933709.com | www.ybao6.com | www.9jjc.com | www.ya939.com | www.8000hc.com | www.2875z.com | www.2632h.com | www.8499z.com | www.33598j.com | www.50064l.com | www.60108p.com | www.77802s.com | www.73736f.com | www.60007m.com | www.66332r.com | www.68682q.com | www.36788c.com | www.9478z.com | www.3005x.com | www.626by.com | www.zfcp5.com | www.ybao6.com | www.ck5568.com | www.901833.com | www.808523.com | www.xcw866.com | www.439863.com | www.163734.com | www.81678r.com | www.50026l.com | www.52072d.com | www.2109q.com | www.csgc2.com | www.937816.com | www.613595.com | www.330832.com | www.77210d.com | www.97655d.com | www.3005.am | www.qmfc7.com | www.xinyc2.com | www.404499.com | www.281877.com | www.68689q.com | www.m.55xj.vip | www.848366.com | www.341977.com | www.62118f.com | www.29277d.com | www.gczj6.com | www.607323.com | www.025079.com | www.35918b.com | www.c9331.com | www.505170.com | www.50054u.com | www.2875q.com | www.803402.com | www.217030.com | www.50024f.com | www.369888a.com | www.330716.com | www.80065s.com | www.23040.com | www.317787.com | www.07163v.com | www.igcp0.com | www.369073.com | www.78949z.com | www.ya044.com | www.339786.com | www.81233f.com | www.964977.com | www.153918.com | www.6769l.com | www.594243.com | www.bxcp3.com | www.976550.com | www.153328.com | www.3005.am | www.hcw823.com | www.68568f.com | www.837887.com | www.43818b.com | www.cb3988.com | www.87668x.com | www.hong663.com | www.178281.com | www.5086v.com | www.476669.com | www.cll168.com | www.399046.com | www.33598f.com | www.550164.com | www.26878t.com | www.501251.com | www.8816l.com | www.299695.com | www.500yf.com | www.84499s.com | www.lycp886.com | www.50064k.com | www.901180.com | www.78949q.com | www.631027.com | www.8499s.com | www.330716.com | www.12czj.com | www.77114d.com | www.809215.com | www.52072p.com | www.288645.com | www.hx1181.com | www.76520n.com | www.364077.com | www.caim2.com | www.78949l.com | www.376395.com | www.csgc7.com | www.66652b.com | www.354911.com | www.6769a1.com | www.50080n.com | www.050236.com | www.809216.com | www.022yn.cc | www.87668g.com | www.259291.com | www.842686.com | www.3479w.com | www.33588w.com | www.355911.com | www.904830.com | www.0014j.com | www.81678q.com | www.112559.com | www.rcw321.com | www.hh8618.com | www.5441y.com | www.12455r.com | www.136025.com | www.756398.com | www.bxcp3.com | www.33588h.com | www.33997i.com | www.069961.com | www.506932.com | www.824980.com | www.tctx2.com | www.8839l.com | www.68689y.com | www.55228j.com | www.140599.com | www.530126.com | www.679822.com | www.wcp686.com | www.c5128.com | www.33fzc.com | www.5441q.com | www.00665g.com | www.66332s.com | www.88266b.com | www.35155f.com | www.54400m.com | www.34788y.com | www.52303g.com | www.83033p.com | www.99788k.com | www.108097.com | www.025738.com | www.bxcp3.com | www.068639.com | www.057452.com | www.088186.com | www.036874.com | www.025532.com | www.91233p.com | www.88858c.com | www.77801i.com | www.50054e.com | www.50080c.com | www.00840t.com | www.51515m.com | www.50024.com | www.781566.com | www.126xc.com | www.ycp4.com | www.915422.com | www.642977.com | www.455518.com | www.220755.com | www.77803h.com | www.39500h.com | www.50074d.com | www.3478j.cc | www.cb2588.com | www.663738.com | www.320660.com | www.68568d.com | www.66653h.com | www.1888ac.com | www.995168.com | www.592411.com | www.108013.com | www.99677s.com | www.2934c.com | www.955494.com | www.599546.com | www.190883.com | www.32123m.com | www.5091n.com | www.946689.com | www.394077.com | www.39500c.com | www.9818.cc | www.730979.com | www.106036.com | www.50080w.com | www.hx1161.com | www.477373.com | www.39500h.com | www.371x.cc | www.649477.com | www.77801c.com | www.5484a.com | www.770816.com | www.83033s.com | www.5095s.com | www.833585.com | www.127356.com | www.81699.cc | www.801896.com | www.035069.com | www.7116b.com | www.745126.com | www.80767l.com | www.1035l.com | www.548411.com | www.80767l.com | www.912269.com | www.65707q.com | www.07hc.com | www.137105.com | www.2632q.com | www.377591.com | www.26878k.com | www.653436.com | www.08588d.com | www.895010.com | www.39500l.com | www.cp8016.cc | www.66376s.com | www.c6569.com | www.68689m.com | www.hy5755.com | www.68682t.com | www.cb7588.com | www.50026q.com | www.880686.com | www.50064q.com | www.937150.com | www.35918y.com | www.803244.com | www.68689t.com | www.514977.com | www.3479k.com | www.183093.com | www.igcp6.com | www.43131b.com | www.757209.com | www.33598h.com | www.xcw866.com | www.067wy.com | www.80065c.com | www.931499.com | www.77803w.com | www.rcw8811.com | www.065wy.com | www.41518u.com | www.602852.com | www.3126a.com | www.68689w.com | www.766859.com | www.6364x.com | www.139670.com | www.957806.com | www.00711.cc | www.76520x.com | www.607265.com | www.072wy.com | www.12455n.com | www.330672.com | www.588088a.com | www.31744.com | www.84499k.com | www.632750.com | www.092wy.com | www.68682g.com | www.211857.com | www.807266.com | www.588yc.com | www.77803j.com | www.109716.com | www.599849.com | www.hm5222.com | www.33112h.com | www.43131b.com | www.192722.com | www.599684.com | www.976981.com | www.917gc.com | www.07163g.com | www.91233z.com | www.376395.com | www.701671.com | www.c5128.com | www.782w.com | www.61233pp.com | www.26299b.com | www.80075l.com | www.344680.com | www.599210.com | www.840680.com | www.c2813.com | www.011ac.com | www.33997.com | www.50064l.com | www.91233z.com | www.39500d.com | www.77114t.com | www.106036.com | www.178759.com | www.253529.com | www.451599.com | www.556742.com | www.607217.com | www.665010.com | www.703890.com | www.775710.com | www.793990.com | www.853530.com | www.964688.com | www.899621.com | www.882186.com | www.808793.com | www.763826.com | www.rcw8855.com | www.616971.com | www.xinyc8.com | www.355811.com | www.178562.com | www.068625.com | www.81233m.com | www.66376e.com | www.21202r.com | www.77801j.com | www.25688h.com | www.5095u.com | www.99jtg.com | www.cp3136.com | www.806875.com | www.500107.com | www.210793.com | www.61233z.com | www.53900f.com | www.2373r.com | www.gyfc6.com | www.755910.com | www.xinyc2.com | www.66621i.com | www.71399p.com | www.016ac.com | www.973709.com | www.637012.com | www.590833.com | www.068617.com | www.78700h.com | www.1035z.com | www.csw288.com | www.345835.com | www.50732v.com | www.5095d.com | www.flcb2.com | www.hcw018.com | www.77803k.com | www.07163s.com | www.igcp9.com | www.547099.com | www.68568p.com | www.07163g.com | www.aa3890.com | www.380068.com | www.34788e.com | www.096wy.com | www.621312.com | www.65707e.com | www.1333ac.com | www.640118.com | www.61233q.com | www.2688cai.com | www.641638.com | www.50989f.com | www.657zf.com | www.606930.com | www.50051q.com | www.9889hc.com | www.558402.com | www.83993m.com | www.c96683.com | www.112819.com | www.509866.com | www.564880.com | www.33358c.com | www.998349.com | www.88266x.com | www.699by.com | www.349077.com | www.50024c.com | www.712250.com | www.12455u.com | www.950665.com | www.81520r.com | www.44tdc.com | www.490780.com | www.3005w.com | www.424221.com | www.34788k.com | www.652291.com | www.52303r.com | www.602327.com | www.26163k.com | www.504533.com | www.51558.com | www.325771.com | www.500pt.com | www.112819.com | www.loll3.com | www.68568z.com | www.904827.com | www.68689w.com | www.514677.com | www.626by.com | www.87668c.com | www.955708.com | www.71399c.com | www.509265.com | www.089b.cc | www.77802d.com | www.21202ii.com | www.89980.cc | www.187152.com | www.cpkk7.com | www.95222w.com | www.401278.com | www.w635.com | www.09500w.com | www.444029.com | www.23040.com | www.88266p.com | www.363067.com | www.hr9888.com | www.78949z.com | www.249770.com | www.cp2838.com | www.35155m.com | www.99677w.com | www.701574.com | www.9889hc.com | www.07163h.com | www.332790.com | www.971291.com | www.cll168.com | www.60108i.com | www.500106.com | www.318548.com | www.32123g.com | www.71399o.com | www.451770.com | www.935960.com | www.5086q.com | www.33588m.com | www.112669.com | www.564658.com | www.cb7588.com | www.3005.am | www.23636g.com | www.178612.com | www.655870.com | www.983888.com | www.985jc.com | www.89980.cc | www.bxcp3.com | www.78949c.com | www.394677.com | www.703027.com | www.987441.com | www.656by.com | www.9149i.com | www.41518e.com | www.80767p.com | www.235952.com | www.11djcp.com | www.653192.com | www.565378.com | www.987434.com | www.hx1111.com | www.tang000.com | www.6832p.com | www.99340.cc | www.26163j.com | www.60108r.com | www.60108c.com | www.68568r.com | www.77210c.com | www.89894r.com | www.81678l.com | www.77803q.com | www.80075j.com | www.73166b.com | www.54400c.com | www.41518j.com | www.39459.cc | www.2934l.com | www.073wy.com |