Goal: To stop the robot when it senses an obstacle ahead.
The obstacle sensor block, positioned in the number window, returns a numeric value (in cm) on how close the robot is to the obstacle. With this value you can set your own threshold, telling the robot on what to do when the threshold is reached.
Check if the value returned by the obstacle sensor block is less than 20 cm.
If yes, then stop the robot. Else keep moving forward. The complete program is shown below.