我在测验中有3个变量,在测验结束时,这些变量中的1个将比其他变量高,但是也可能是这些变量中的1个具有与另一个变量完全相同的值,甚至3个变量的值都完全相同。我可以运行什么功能来读取这三个变量并打印答案? (我遇到的问题是,有时它会读取两个具有相同值的变量并将其打印为答案,而一个变量高于其他两个变量)
我将试图在此处执行的代码放在此处,但无法正常使用
var VFinal = 9
var AFinal = 5
var KFinal = 5
var resultText = ""
func finalResultText() {
if VFinal > KFinal && VFinal > AFinal {
resultText = "Visual, Auditive and Kinesthetic"
} else if KFinal > VFinal && KFinal > AFinal {
resultText = "Visual and Auditive"
} else if AFinal > VFinal && AFinal > KFinal {
resultText = "Visual and Kinesthetic"
} else if KFinal == AFinal {
resultText = "Auditive and Kinesthetic"
} else if AFinal == VFinal {
resultText = "Kinesthetic"
} else if VFinal == KFinal {
resultText = "Auditive"
} else if AFinal == VFinal && AFinal == KFinal {
resultText = "Visual"
}
}
var VFinal = 5
var AFinal = 5
var KFinal = 5
func finalResultText() {
if KFinal > VFinal && KFinal > AFinal {
print("Kinesthetic")
} else if AFinal > VFinal && AFinal > KFinal {
print("Auditive")
} else if VFinal > KFinal && VFinal > AFinal {
print("Visual")
} else if AFinal == VFinal && AFinal == KFinal {
print("Visual, Auditive and Kinesthetic")
} else if AFinal == VFinal {
print("Visual and Auditive")
} else if VFinal == KFinal {
print("Visual and Kinesthetic")
} else if KFinal == AFinal {
print("Auditive and Kinesthetic")
}
}