Understanding the code (total newbie)

Hi, I've just started practicing with coding, and i have a couple of questions.

I want to build a project that includes a US sensor for distance measuring so a robot can stop at a set distance from an obstacle, so i figured i'll try this tutorial, and i have trouble understanding some stuff.

1) why this sketch doesn't need a library, is it build in already? 2) i found this library, should i use it? 3) when should i use libraries?

Tnx!

It's a lot easier for us if you ask specific questions.

A library is a set of functions that are usually aimed at a single task. So the LiquidCrystal library is used to perform tasks on an LCD display, like positioning the cursor, clearing the display, writing text to the display, and so on. You should use a library virtually any time one exists for your task at hand. You can always write your own code, but why reinvent the wheel? Many general purpose libraries, like the LiquidCrystal library, are distributed with the Arduino IDE. However, there are probably hundreds of other specialized libraries written for the Arduino. Any time you have a specific task, like your distance sensor task, your first step to solving the task is spending some time with Google. I googled "Arduino distance sensor" and got over 344,000 hits. Surely one of those would be of help to you.

Finally, make sure you read the two posts at the top of this Forum by Nick Gammon. He has guidelines for posting here that will maximize the help you get here.