var sampleArray = [8.0, 7.0, 19.0, 28.0] for (index,value) in sampleArray.enumerated(){ sampleArray [index] = value / 2 } print(sampleArray) // ".0" in each number changes it from integer to double, that way when we divide them by 2 the result will be more accurate. Another way to do it:
var sampleArray = [Double]() sampleArray = [8.0, 7.0, 19.0, 28.0] for (index,value) in sampleArray.enumerated(){ sampleArray [index] = value / 2 } print(sampleArray)
Happy coding ;)