Highlighted

For Loop

Avatar

21-08-2008

There has to be an easier way to write this code (which does work). Would a for loop do it? And if so - how?



if (AddressIntEField.rawValue !=null) {

AddressIntEField.presence = "visible", relevant="+print";

RadioButtonList.rawValue = "2";

}

if (AddressIntDField.rawValue !=null) {

AddressIntDField.presence = "visible", relevant="+print";

AddressDField.presence = "invisible", relevant="+print";

RadioButtonList.rawValue = "2";

}

if (AddressIntCField.rawValue !=null) {

AddressIntCField.presence = "visible", relevant="+print";

AddressCField.presence = "invisible", relevant="+print";

RadioButtonList.rawValue = "2";

}

if (AddressIntBField.rawValue !=null) {

AddressIntBField.presence = "visible", relevant="+print";

AddressBField.presence = "invisible", relevant="+print";

RadioButtonList.rawValue = "2";

}

else {

RadioButtonList.rawValue = "1";

AddressIntEField.presence = "invisible", relevant="+print";

AddressIntDField.presence = "invisible", relevant="+print";

AddressIntCField.presence = "invisible", relevant="+print";

AddressIntBField.presence = "invisible", relevant="+print";

}