Every time around the loop, one of the two assignments is made -- most of the time, the "no such employee" one. This is a misnomer -- it doesn't mean there's no such employee -- it means that the ssn doesn't match this particular employee, the one at index "i". When the loop ends, most of the time the string will be "no such employee," as this was the last assignment to execute.