Pressed vs Bumped
I was playing around in NXT-G today and found an interesting fact with the LOOP block.
I set up a loop to play a high note, 1 second break, low note, 1 second break and to loop until touch sensor is pressed. Once the touch sensor is 'pressed' it will break out of the loop and say goodbye.

Now if I press and release the touch sensor when it is playing the low note, by time it has finished the high note, the touch sensor is no longer pressed and the program loops as expected. To paraphrase, because the touch sensor has not been pressed at the exact time the loop block is checked, it continues to loop. This is exactly I as expected.
However, if I change the the loop condition to look for the sensor being 'bumped' (pressed and released) it doesn't matter when in the loop I press the button, it will remember it and once it checks the loop conditions after the high note, it will exit the loop.
This also works for the NXT buttons as inputs but not any of the other sensors.
--
Damien Kee
I set up a loop to play a high note, 1 second break, low note, 1 second break and to loop until touch sensor is pressed. Once the touch sensor is 'pressed' it will break out of the loop and say goodbye.

Now if I press and release the touch sensor when it is playing the low note, by time it has finished the high note, the touch sensor is no longer pressed and the program loops as expected. To paraphrase, because the touch sensor has not been pressed at the exact time the loop block is checked, it continues to loop. This is exactly I as expected.
However, if I change the the loop condition to look for the sensor being 'bumped' (pressed and released) it doesn't matter when in the loop I press the button, it will remember it and once it checks the loop conditions after the high note, it will exit the loop.
This also works for the NXT buttons as inputs but not any of the other sensors.
--
Damien Kee
Comments
-Jonathan
RoboLab is able to exit a loop at anytime, something I miss in NXT-G
>limitation of NXT-G
Yeah I know... and like you said, the problem with STOP is that it ends the program. I'd think it would be pretty easy for LEGO to include a "Break" block that would simply exit the loop it's in, and it would be an enormous help in some cases. As for now, I usually end up having to use a really complex solution... most times I try to make everything in the loop happen "instantly" (such as only doing things like modifying variables or turning on motors for unlimited) so that it will exit as soon as the trigger condition is met.
-Jonathan
As a language it is, to put it kindly, lacking. There a number of other languages out there for the NXT that provide a great deal more functionality. There are both graphical user interfaces such as Robolab, and more standard text base interfaces such as that used by RobotC, etc.