Problem in understanding respond_to in rails 2.0 and above

Hi,
I am using rails 2.2.

I have created a controller using “ruby script/generate scaffold
person”.
This created the code like this.

def index
@people = Person.find(:all)

respond_to do |format|
  format.html
  format.xml { render :xml => @people.to_xml }
end

end

I am new in rails 2.0 and above. I worked on rails 1.2.3. I an not able
to understand what is the use of

“respond_to do |format|
format.html
format.xml { render :xml => @people.to_xml }
end” this code.

Can anyone focus for me?
Help appreciated.

Also there are some code like this
“respond_to do |format|
format.html
format.js
format.xml { render :xml => @people.to_xml }
end”

Thanks,
Tushar