Running through the swift 2.0 documentation and Im trying to practice some stuff I learned in c++. One of which is the ability to modify array elements inside of my element which I am having trouble doing in swift.
var scoreOfStudents = [86, 93, 68, 78, 66, 87, 80]
func returnScoresWithCurve (inout scoresOfClass : [Int]) -> [Int] {
for var score in scoresOfClass {
if score < 80 {
score += 5
}
}
return scoresOfClass
}
Don't know what my error is because in the for-in loop, the scores less than 80 are being added but aren't being modified in the array I passed. Also would like to know how I can do this same thing using a nested function and not for-in loops.