View Single Post
  #4   Spotlight this post!  
Unread 27-09-2015, 09:28
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Attached Thumbnails
Click image for larger version

Name:	From Clipboard.png
Views:	46
Size:	34.3 KB
ID:	19319  
Reply With Quote