// min is blue -> calculate relative red and green steps // Analysis else { steps = Math.abs(difBlue); Rsteps = difRed / Math.abs(difBlue); Gsteps = difGreen / Math.abs(difBlue); if(difBlue > 0) Bsteps = 1; else Bsteps = -1; }Once again, this section of code is the same as the two previous sections. Because the conditionals that determine which set of code to use follow the pattern of 'if ... else if ... else' we can be sure that min is blue without having to specifically test for that value.
If you are creating a code with a large number of separate functions that have to interact in a
specific manner, it is a good idea to test specifically for the last case, and create a default section of
code that presents you with an error message. Then, if there is an error in the final code due to incorrect
interfacing between functions, the code will report it, instead of either working incorrectly or not
working at all, both of which are difficult to debug.