If you consider yourself a beginner, just work with a delay for now until you get the hang of things and the basics working.
A more fancy way to do it would be:
while(nothing_in_the_way)
{drive_forward()}
rotate_90_degrees();//if something in the way, it turns