I have to run some algorithms on certain health industry numbers for validations. One of them requires checking if a total at a certain point ends in zero, if not get the next highest number that ends in zero. I have this code but am wondering if there is a better way to do it:
let strTotal = String(iTotal)
var iSubtractor = iTotal
if Int(String(strTotal.last!))! != 0 {
var bIsZeroEnding = false
repeat {
iSubtractor += 1
let strSubstractor = String(iSubtractor)
if Int(String(strSubstractor.last!))! == 0 {
bIsZeroEnding = true
}
} while !bIsZeroEnding
}
Doh...I do see the typo in my var name...strSubstractor... :D