User:Brian P. Josey/Notebook/2010/08/12

From OpenWetWare

Jump to: navigation, search
Project name Main project page
Previous entry      Next entry

Decision Making and If, Then, Else Statements

The select function is a block that has two data wires and a Boolean logic wire as inputs, with one data string as an output. The data inputs are wired so that one is associated with a true value, and the other with the false value from the Boolean input. This allows for a simple switch to be encoded into the code and used to choose between two different options, and output the chosen option.

Case structures are a more versatile approach to choosing different cases. It can have up to 231-1 cases, but having two, one for true and one for false, or around that value is more appropriate. The type and number of cases is determined by a case selector wired into the left side of the case structure.


Personal tools