|
Re: Need Help With Case Statemet
My first suggestion would be to select the loop containing the logic and click the cleanup button on the toolbar. It is the one with the small broom on it. That way we will be able to se how the logic and variables are attached.
In the attached image, I show three alternate ways to combine the logic and select values. i generally use one of the top two. If it is not only values that are changing, but alternate code, I'll use something more like the bottom one.
By the way, the most important thing is that the code makes sense to you and works correctly. These alternate ways of writing it are suggestions, but be sure you understand them before redoing anything.
I like to do this by writing the code in parallel, right next to the existing code. Then you can look at the old and new side-be-side and reason about it. You can review a truth table, sketch a graph, or whatever helps you to understand it and prove that the old and new code work the same. You can even leave most of the old and new code in, run them and compare the results as you run code.
Greg McKaskle
|