IBM interview question

Explain in which scenario you would write certain code?