代码:
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)
答案 0 :(得分:1)
所以我运行了你的代码,我收到了bucketList
未定义的错误
SOOO
我在定义let
之前添加了bucketList
它奏效了
输出是
"Go on a walkabout"