Value set to ret will be overwritten at least once at the end of the while loop, removing assignment.