August 2010
Intermediate to advanced
288 pages
13h 21m
English
The final math-related block is the Range block, which determines whether a number is inside or outside a range of numbers. For example, say you want to know whether the reading from the Light Sensor is between 40 and 60. You could pass the output value from a Light Sensor block to two Compare blocks and a Logic block, as shown in Figure 14-31.

Figure 14-31. Is the Light Sensor reading between 40 and 60?
This approach will certainly work. However, checking to see whether a number is in a certain range is so useful that NXT-G provides a quicker way to do this. Using the Range block, you can perform the same comparison using one block ...