为什么我的代码输出了最终的打印功能?

时间:2017-06-10 16:33:42

标签: arrays swift printing

代码:

bucketList = ["Fly hot air balloon to Fiji", "Watch the LOTR trilogy", "Go on a walkabout", "Scuba dive", "Find a triple rainbow"]

let challenge = bucketList.index(of: "Fly hot air balloon to Fiji")

let offset = challenge! + 2

let finalIndex = bucketList[offset]

print(finalIndex)

1 个答案:

答案 0 :(得分:1)

所以我运行了你的代码,我收到了bucketList未定义的错误 SOOO 我在定义let之前添加了bucketList 它奏效了 输出是

"Go on a walkabout"
相关问题