In general, if you have many different cases, then it is preferable to use the CASE statement (‘switch’ in other languages) as DrBwts said. Also, as Gereon said, in your example you could decrease the cases you check. So for your example it would look something like this:
CASE MaxContaminationCode OF -2: ContaminationClass := '000'; -1: ContaminationClass := '00'; 0..12: // if you ONLY want 0 to 12, otherwise use ELSE here ContaminationClass := INT_TO_STRING(MaxContaminationCode); END_CASE
CLICK HERE to find out more related problems solutions.