一个没有集合的世界假如世界没有集合假如没有array假如, 我们要定义一个熊, 我们可以let bear1 = "grizzly"如果, 我们要四个呢?let bear1 = "grizzly" let bear2 = "panda" let bear3 = "polar" let bear4 = "spectacled"现在, 让我们尝试打印出来let bear1 = "grizzly" let bear2 = "panda" let bear3 = "polar" let bear4 = "spectacled" print("(bear1) bear")  grizzly bear print("(bear2) bear")  panda bearprint("(bear3) bear")  polar bear print("(bear4) bear")  spectacled bear我们需要不断的做重复的事情假如没有dictionary让我们继续上面的例子, 现在我们有一个记录每个熊的喜好的函数f nc habitat(for bear: string) - string? { if bear == "polar" { ret rn "arctic" } else if bear == "grizzly" { ret rn "forest" } else if bear == "brown" { ret rn "forest" } else if * all the other bears * ... ret rn nil }我们仍然有很多重复的事情需要做.一个拥有集合的世界当我们引入集合的概念, 上面的事情, 就变得清晰明亮了let bear = ["grizzly", "panda", "polar", "spectacled"] let habitats = ["grizzly": "forest", "polar": "arctic"] for bear in bears { print("(bear) bear") } let bear = bears[2] let habitat = habitats[bear] ??