如何连接我的阵列 [英] How to connect my array
本文介绍了如何连接我的阵列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
代码很快,试图连接朋友列表中底部的名称。到连接到顶部的消息。
The code is in swift, trying to connect the names that in the friends list that at the bottom. To the message connected to the top.
func invite(allGuests: [String]) {
for guest in allGuests {
invite(guest: guest)
}
print("Dear \(guest),")
print("I'd love for you to come to my birthday party!")
print("It's going to be this Saturday at my house.")
print("I hope that you can make it!")
print("Love, Brenna\n")
}
let friends = ["Cathy", "Maddie", "Julia", "Sophia", "Asher"]
invite(allGuests: friends)
我尝试了什么:
我尝试在打印中切换并转动客人(亲爱的\(嘉宾))到allGuest。这不起作用
What I have tried:
I try switching and turning guest that in the print("Dear \(guest)") to "allGuest". That didn't work
推荐答案
将print语句放在循环中而不是在它之外......
Put the print statements inside the loop instead of outside it...
这篇关于如何连接我的阵列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文