There is a tutorial section here - http://arduino.cc/en/Tutorial/HomePage - with a lot of example code,
please take a few days to work through these examples to learn the basics of the Arduino language.
You will learn a lot of things by going through these code examples especially when you modify the sample code and run it on your board.
digitalWrite(6, digitalRead(4)); is what you are looking for.