Loop through all person records and update records

Dear Experts

I have to develop a script to run through all person records and update fields on certain records if it meet with certain condition. Does anyone know where I can get the sample reference.

Thanks

Gary