let result = (someValue == i ? next : nil)
i += 1
return result

または

let oldi = i
i += 1
return someValue == oldi ? next : nil