func answersAndResults (answerIndex: Int, link: Dictionary <Int, Int>) {
if inputIndex == answerIndex {
for (linkedResult, weight) in link {
linkedResult += weight // Left side of mutating operator isn't immutable: "linkedResul" is a let costant
}
}
}
我怎么能在循环改变字典的动态值与用于如何在循环改变字典的动态值以在迅速
无关,但您需要学习使用适当的命名约定。只有类名应该以大写字母开头。变量,方法和参数名称都应以小写字母开头。你的函数应该是'func answersAndResults(answerIndex:Int,link:Dictionary)''。遵循这些标准使您的代码更易于被他人阅读。 –
rmaddy
谢谢@maddy – Fra01