Lots of examples in the forum - the exact details will depend on what you are trying to stop the object from going through. On place to start is the thread
http://www.alice.org/community/showt...highlight=maze . Also, as suggested there, do a search on "collision".
In any case, you will have to use one of Alice's relative distance functions like ottosparks suggests. Again - that's pretty well covered in the thread. In all cases, however, the distances are
measured to the center of an object, not an edge so for large objects you will have to be careful how you set up your conditional statements. For walls, etc. - "in front of", "behind" and "to the right/left of" can be more usefull than simply "distance to" or "within a threshold of".
Either if statements and loops or while statements work fine - the while statement is generally easier to set up. There are several examples like that in the texts.