Whoa, shove! The data structure in Swift is like this, it is a concise ah, not much to say the code to get:
Import Foundationprint ("Hello, world!.") var p1= -//String is the class string inside SwiftLet P2 ="value is"+String (p1) print ("P2 is \ (p2)") var p3= ["IOS","Android","WP"] forIinchp3{Print ("I is \ (i)")}//modified the No. 0 item of the array.p3[0] ="Ios/swift" forIinchp3{Print ("I1 is \ (i)")}//append an element after the P3 arrayP3.append ("Symbian") forIinchp3{Print ("i2 is \ (i)")}//Define a dictionaryvar P4 = [ "name":"XZR", " Age":" -", "score":" -",]//dictionary with [] preceded by key is the value for(Key,value)inchp4{Print ("key value \ (key) = \ (value)")}//Append content to the dictionaryp4["Course"] ="IOS"; for(Key,value)inchp4{Print ("key value2 \ (key) = \ (value)")}let P5=P4.keys forKeyinchp5{Let v=P4[key] Print ("key is \ (key) = \ (v)") }//tuple "In fact array"Let numbers = [ "IOS":[1,2,3,5,6], "Android":[ -, at, $, the], "WP":[ +, the, the]]var Sum:int=0 for(Key,value)inchnumbers{ forIinchvalue{sum+=i}} Print ("sum is \ (sum)")
Command + R, you'll know.
Oh, Jiangzi, have you made it?
Swift Basic _ Data structure