Motorola Solutions Interview Question

Why did you write the code in this way? (Have to explain what you have write)