If this is your first time visiting the Passcode Lock settings, then you will be prompted to create a 4-digit passcode -- this can be anything, just make it memorable. Once you've entered and confirmed your passcode, you will see a couple options. The first two buttons let you turn the passcode lock off, or change your passcode.
The next option, called "Require Passcode," allows you to set the interval between which your iPhone will require you to enter your passcode. For instance, if you set this interval for 5 minutes and you "sleep" your iPhone, you will be able to wake it and start using it again (without entering your passcode) for up-to five minutes after you put it to sleep. After the 5-minute time period has passed, your iPhone will require the passcode upon waking.
You also have the ability to turn SMS Preview on/off. By showing the SMS preview, the sender's name (or number) and a few lines of the message will be displayed. If you have this option turned off, you will only see the generic "1 New Text Message" on the wake screen.
For more protection, enable the "Erase Data" option. This erases all data from the device if someone tries to enter the wrong passcode more than 10 times.
With the passcode lock turned on, you have the peace of mind that comes with knowing your device, and data is safe. When you wake your iPhone by sliding a finger to unlock it, you will be presented with a number pad to enter your 4-digit code on. Upon successfully entering your code, the home screen will be displayed. Note that this works for the iPod touch as well.
Want more tips and tricks like this? Visit TUAW's iPhone 101 section today!