How does a planets distance from a sun effect its compistition?
Good question! In a planet forming disk, the rocky material is near to the star, and the icy materials are farther out. Gas is cleared out from the inner region of a solar system by the star. Thus, we expect inner worlds to be rocky, and outer worlds to be icy and/or gaseous. This is what we find in our solar system. However planets can migrate. A gas planet can interact with its planet-forming disk and spiral inward toward its star. It will stop falling inward when the planet reaches the inner edge of the planet-forming disk. We see planets like this a lot orbiting many stars, such as 51 Pegasi, HD 209458, HD 189733. Solar systems around other stars are proving to be very diverse, and we’re still figuring all this stuff out.