Expressing 2x2 Logic Grid in Code Efficiently
问题 In an event handler I'm responding to the change of a value. I have access to the old value and the new value and want to do certain things depending on what the change is. Each different outcome will do some combination of actions/functions X, Y, or Z. Z accepts a parameter between -1 and 1. Order of performing these is not important. Look at the following logic grid. The old value is the leftmost column of labels, and the new value is the top row of labels: New: 0 !=0 -------- ------- Old: