P
pauldepstein
I am coding for a large company and I have a block of code in front of
me that looks like the below, but with names changed for
confidentiality reasons.
SomeFunction(StudentClass Mary, StudentClass Jill, StudentClass Vijay)
// In reality there are about a dozen variable names
if (Mary.HasProblem() || Jill.HasProblem() || Vijay.HasProblem() )
// and on and on
{ return StudentClass("A student has a problem");}
So I'm changing it to
if(Mary.HasProblem()) returnStudentClass("Mary has a problem.");
if(Jill.HasProblem()) returnStudentClass("Jill has a problem.");
if(Vijay.HasProblem()) returnStudentClass("Vijay has a problem.");
// many more similar statements.
I'm doing this to get more accurate diagnostic messages.
What is a more compact way of doing the above?
Thanks a lot for your help.
Paul Epstein
me that looks like the below, but with names changed for
confidentiality reasons.
SomeFunction(StudentClass Mary, StudentClass Jill, StudentClass Vijay)
// In reality there are about a dozen variable names
if (Mary.HasProblem() || Jill.HasProblem() || Vijay.HasProblem() )
// and on and on
{ return StudentClass("A student has a problem");}
So I'm changing it to
if(Mary.HasProblem()) returnStudentClass("Mary has a problem.");
if(Jill.HasProblem()) returnStudentClass("Jill has a problem.");
if(Vijay.HasProblem()) returnStudentClass("Vijay has a problem.");
// many more similar statements.
I'm doing this to get more accurate diagnostic messages.
What is a more compact way of doing the above?
Thanks a lot for your help.
Paul Epstein