@@ -263,6 +263,10 @@ occupations["Jayne"] = "Public Relations"
263263 ```
264264-->
265265
266+ <!--
267+ iBooks Store screenshot begins here.
268+ -->
269+
266270Arrays automatically grow as you add elements.
267271
268272``` swift
@@ -280,44 +284,43 @@ print(fruits)
280284 ```
281285-->
282286
283- To create an empty array or dictionary,
284- use the initializer syntax.
287+ You also use brackets to write an empty array or dictionary.
288+ For an array, write ` [] ` ,
289+ and for a dictionary, write ` [:] ` .
285290
286291``` swift
287- let emptyArray: [ String ] = []
288- let emptyDictionary: [ String : Float ] = [: ]
292+ fruits = []
293+ occupations = [: ]
289294```
290295
291296<!--
292297 - test: `guided-tour`
293298
294299 ```swifttest
295- -> let emptyArray: [String] = []
296- -> let emptyDictionary: [String: Float] = [:]
300+ -> fruits = []
301+ -> occupations = [:]
297302 ```
298303-->
299304
300- If type information can be inferred,
301- you can write an empty array as ` [] `
302- and an empty dictionary as ` [:] ` ---
303- for example, when you set a new value for a variable
304- or pass an argument to a function.
305-
306- <!--
307- iBooks Store screenshot begins here.
308- -->
305+ If you're assigning an empty array or dictionary to a new variable,
306+ or another place where there isn't any type information,
307+ you need to specify the type.
309308
310309``` swift
311- fruits = []
312- occupations = [: ]
310+ let emptyArray: [ String ] = []
311+ let emptyDictionary: [ String : Float ] = [: ]
313312```
314313
314+
315315<!--
316316 - test: `guided-tour`
317317
318318 ```swifttest
319- -> fruits = []
320- -> occupations = [:]
319+ -> let emptyArray: [String] = []
320+ -> let emptyDictionary: [String: Float] = [:]
321+ ---
322+ -> let anotherEmptyArray = [String]()
323+ -> let emptyDictionary = [String: Float]()
321324 ```
322325-->
323326
0 commit comments